feat(property):
- 数字孪生接口 - xcx活动接口权限
This commit is contained in:
@@ -77,4 +77,9 @@ public interface RemoteDeviceService {
|
||||
*/
|
||||
RemoteDeviceStateStatistics statisticsMonitorState();
|
||||
|
||||
/**
|
||||
* 统计富士门禁设备在线数量
|
||||
* @return 统计数据
|
||||
*/
|
||||
RemoteDeviceStateStatistics statisticsDoorState();
|
||||
}
|
||||
|
@@ -64,8 +64,12 @@ public class SaPermissionImpl implements StpInterface {
|
||||
"xcx:visitorManagement:edit",
|
||||
"xcx:visitorManagement:list",
|
||||
"xcx:visitorManagement:getQrCode",
|
||||
// 社区活动管理
|
||||
"xcx:activity:list",
|
||||
"xcx:activity:query",
|
||||
// 文件上传
|
||||
"system:oss:upload"
|
||||
"system:oss:upload",
|
||||
"system:oss:query"
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,15 @@
|
||||
package org.dromara.property.controller.cockpit;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.property.domain.bo.smartDevicesBo.TbMeterInfoBo;
|
||||
import org.dromara.property.domain.vo.cockpit.DeviceState;
|
||||
import org.dromara.property.domain.vo.smartDevicesVo.TbMeterInfoVo;
|
||||
import org.dromara.property.service.smartDevicesService.ITbMeterInfoService;
|
||||
import org.dromara.sis.api.RemoteDeviceService;
|
||||
import org.dromara.sis.api.domain.RemoteDeviceStateStatistics;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -27,22 +31,25 @@ import java.util.concurrent.TimeUnit;
|
||||
@RequestMapping("/cockpit")
|
||||
public class DriverController {
|
||||
|
||||
|
||||
@Resource
|
||||
private ScheduledExecutorService executeService;
|
||||
|
||||
@Resource
|
||||
private ITbMeterInfoService tbMeterInfoService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteDeviceService remoteDeviceService;
|
||||
|
||||
/**
|
||||
* 获取设备状态接口
|
||||
*
|
||||
* @param deviceType 0:全部,1:监控设备,2:水表,3t:电表,4:灯孔,5:门禁
|
||||
* @param deviceType 0:全部,1:监控设备,2:水表,3t:电表,4:门禁
|
||||
* @return 返回设备状态数据
|
||||
*/
|
||||
@GetMapping("/device/state/{deviceType}")
|
||||
public R<?> getDeviceState(@PathVariable Integer deviceType) throws InterruptedException {
|
||||
Assert.isTrue(deviceType <= 5 && deviceType >= 0, "未知的设备类型");
|
||||
int searchNum = deviceType == 0 ? 5 : 1;
|
||||
Assert.isTrue(deviceType <= 4 && deviceType >= 0, "未知的设备类型");
|
||||
int searchNum = deviceType == 0 ? 4 : 1;
|
||||
List<DeviceState> result = new ArrayList<>(searchNum);
|
||||
CountDownLatch countDownLatch = new CountDownLatch(searchNum);
|
||||
// 查询监控设备状态
|
||||
@@ -60,22 +67,58 @@ public class DriverController {
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
}
|
||||
|
||||
//查询水表
|
||||
if (deviceType == 0 || deviceType == 2) {
|
||||
|
||||
executeService.execute(() -> {
|
||||
TbMeterInfoBo bo = new TbMeterInfoBo();
|
||||
bo.setMeterType(2L); // 水表
|
||||
List<TbMeterInfoVo> meterInfoList = tbMeterInfoService.queryList(bo);
|
||||
if (CollUtil.isNotEmpty(meterInfoList)) {
|
||||
DeviceState state = new DeviceState();
|
||||
state.setType(2);
|
||||
state.setTypeName("水表");
|
||||
state.setOnLine(meterInfoList.stream().filter(item -> item.getCommunicationState() == 1).toList().size());
|
||||
state.setTotal(meterInfoList.size());
|
||||
result.add(state);
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
}
|
||||
// 查询电表
|
||||
if (deviceType == 0 || deviceType == 3) {
|
||||
|
||||
}
|
||||
// 查询灯
|
||||
if (deviceType == 0 || deviceType == 4) {
|
||||
|
||||
executeService.execute(() -> {
|
||||
TbMeterInfoBo bo = new TbMeterInfoBo();
|
||||
bo.setMeterType(1L); // 水表
|
||||
List<TbMeterInfoVo> meterInfoList = tbMeterInfoService.queryList(bo);
|
||||
if (CollUtil.isNotEmpty(meterInfoList)) {
|
||||
DeviceState state = new DeviceState();
|
||||
state.setType(3);
|
||||
state.setTypeName("电表");
|
||||
state.setOnLine(meterInfoList.stream().filter(item -> item.getCommunicationState() == 1).toList().size());
|
||||
state.setTotal(meterInfoList.size());
|
||||
result.add(state);
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
}
|
||||
// 查询门禁
|
||||
if (deviceType == 0 || deviceType == 5) {
|
||||
if (deviceType == 0 || deviceType == 4) {
|
||||
executeService.execute(() -> {
|
||||
RemoteDeviceStateStatistics remoteDeviceStateStatistics = remoteDeviceService.statisticsDoorState();
|
||||
if (remoteDeviceStateStatistics != null) {
|
||||
DeviceState state = new DeviceState();
|
||||
state.setType(4);
|
||||
state.setTypeName("门禁");
|
||||
state.setOnLine(remoteDeviceStateStatistics.getOnLine());
|
||||
state.setTotal(remoteDeviceStateStatistics.getTotal());
|
||||
result.add(state);
|
||||
}
|
||||
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认10S,超过自动结束
|
||||
*/
|
||||
|
@@ -3,6 +3,7 @@ package org.dromara.property.controller.xcx;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
@@ -24,6 +25,7 @@ import java.util.Map;
|
||||
* @author lsm
|
||||
* @since 2025-06-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
|
@@ -124,6 +124,7 @@ public interface ITbVisitorManagementService {
|
||||
* @return String
|
||||
*/
|
||||
Map<String, Object> getQrCodeByIdForXcx(Long id);
|
||||
|
||||
/**
|
||||
* 大屏访客记录统计
|
||||
*/
|
||||
|
@@ -218,14 +218,16 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
||||
record.setPreviousReading(record.getCurrentReading());
|
||||
}
|
||||
|
||||
// 通信状态改为离线
|
||||
TbMeterInfoBo bo = new TbMeterInfoBo();
|
||||
bo.setId(info.getId());
|
||||
if (record.getCurrentReading().compareTo(BigDecimal.ZERO) == 0){
|
||||
// 通信状态改为离线
|
||||
TbMeterInfoBo bo = new TbMeterInfoBo();
|
||||
bo.setId(info.getId());
|
||||
bo.setCommunicationState(0L);
|
||||
tbMeterInfoService.updateByBo(bo);
|
||||
record.setCurrentReading(record.getPreviousReading());
|
||||
}else {
|
||||
bo.setCommunicationState(1L);
|
||||
}
|
||||
tbMeterInfoService.updateByBo(bo);
|
||||
|
||||
record.setReadingMethod(MeterRecordTypeEnum.AUTO_RECORD.getCode());
|
||||
recordNew.add(record);
|
||||
|
@@ -14,6 +14,9 @@ import org.dromara.sis.domain.covert.CommonBeanCovert;
|
||||
import org.dromara.sis.domain.entity.SisDeviceChannel;
|
||||
import org.dromara.sis.domain.entity.SisDeviceManage;
|
||||
import org.dromara.sis.domain.vo.DeviceStateStatistics;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.ApiResp;
|
||||
import org.dromara.sis.sdk.e8.domain.door.res.AuthDoorDeviceFindRes;
|
||||
import org.dromara.sis.sdk.hik.HikConstants;
|
||||
import org.dromara.sis.service.ISisDeviceChannelService;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
@@ -36,6 +39,7 @@ public class RemoteDeviceServiceImpl implements RemoteDeviceService {
|
||||
|
||||
private final ISisDeviceManageService deviceManageService;
|
||||
private final ISisDeviceChannelService deviceChannelService;
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
|
||||
@Override
|
||||
public List<RemoteSisDeviceManage> queryHikDevices() {
|
||||
@@ -130,4 +134,23 @@ public class RemoteDeviceServiceImpl implements RemoteDeviceService {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计富士门禁设备在线数量
|
||||
*
|
||||
* @return 统计数据
|
||||
*/
|
||||
@Override
|
||||
public RemoteDeviceStateStatistics statisticsDoorState() {
|
||||
ApiResp<List<AuthDoorDeviceFindRes>> res = e8PlatformApi.getPageAuthDoorDeviceList();
|
||||
if (res.getSuccess()) {
|
||||
List<AuthDoorDeviceFindRes> list = res.getResult();
|
||||
RemoteDeviceStateStatistics stateStatistics = new RemoteDeviceStateStatistics();
|
||||
stateStatistics.setTotal(list.size());
|
||||
stateStatistics.setOnLine(list.stream().filter(item -> item.getOnlineStatus() == 1).toList().size());
|
||||
stateStatistics.setOffLine(list.stream().filter(item -> item.getOnlineStatus() == 0).toList().size());
|
||||
return stateStatistics;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
ApiResp<VisitorAddRes> res = e8PlatformApi.getVisitorQrCode(List.of(id));
|
||||
Assert.isTrue(res.getSuccess(), res.getMessage());
|
||||
return res.getSuccess()
|
||||
? Map.of("code", 200, "data,", res.getResult().getQrCodeStr())
|
||||
? Map.of("code", 200, "data", res.getResult().getQrCodeStr())
|
||||
: Map.of("code", 500, "data", res.getMessage());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
Reference in New Issue
Block a user