Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
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:
@@ -65,7 +65,7 @@ public class ServiceWorkOrdersTypeController extends BaseController {
|
||||
@SaCheckPermission("system:workOrdersType:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<ServiceWorkOrdersTypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(serviceWorkOrdersTypeService.queryById(id));
|
||||
}
|
||||
|
||||
@@ -110,6 +110,18 @@ public class ServiceWorkOrdersTypeController extends BaseController {
|
||||
@SaCheckPermission("system:workOrdersType:list")
|
||||
@GetMapping("/typeTree")
|
||||
public R<List<ServiceWorkOrdersTypeVo>> typeTree() {
|
||||
return R.ok(serviceWorkOrdersTypeService.typeTree()) ;
|
||||
return R.ok(serviceWorkOrdersTypeService.typeTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单类型不分页查询
|
||||
*
|
||||
* @param bo 工单类型
|
||||
* @return 工单类型列表
|
||||
*/
|
||||
@SaCheckPermission("system:workOrdersType:list")
|
||||
@GetMapping("/queryList")
|
||||
public R<List<ServiceWorkOrdersTypeVo>> queryList(ServiceWorkOrdersTypeBo bo) {
|
||||
return R.ok(serviceWorkOrdersTypeService.queryList(bo));
|
||||
}
|
||||
}
|
||||
|
@@ -65,6 +65,7 @@ public class ServiceWorkOrdersType extends TenantEntity {
|
||||
/**
|
||||
*上级类型id
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private Long parentId;
|
||||
|
||||
}
|
||||
|
@@ -65,4 +65,11 @@ public class ServiceWorkOrdersTypeBo extends BaseEntity {
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 是否过滤子级
|
||||
*/
|
||||
private Boolean filterSubNodes;
|
||||
|
||||
private Long excludeId;
|
||||
|
||||
}
|
||||
|
@@ -41,13 +41,22 @@ public class InspectionRoutePointVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "巡检路线id")
|
||||
private Long routeId;
|
||||
/**
|
||||
* 巡检路线名称
|
||||
*/
|
||||
@ExcelProperty(value = "巡检路线名称")
|
||||
private Long routeName;
|
||||
|
||||
/**
|
||||
* 巡检点id
|
||||
*/
|
||||
@ExcelProperty(value = "巡检点id")
|
||||
private Long pointId;
|
||||
|
||||
/**
|
||||
* 巡检点名称
|
||||
*/
|
||||
@ExcelProperty(value = "巡检点名称")
|
||||
private String pointName;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
|
@@ -9,6 +9,7 @@ import org.dromara.property.domain.InspectionRoute;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -57,6 +58,8 @@ public class InspectionRouteVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "搜索值")
|
||||
private String searchValue;
|
||||
|
||||
|
||||
/**
|
||||
* 巡检点
|
||||
*/
|
||||
List<InspectionRoutePointVo> inspectionRoutePointVoList;
|
||||
}
|
||||
|
@@ -5,17 +5,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.domain.TreeNode;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbCommunityVo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.service.ITbBuildingService;
|
||||
import org.dromara.property.service.ITbCommunityService;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -32,7 +29,6 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
|
||||
private final ITbCommunityService tbCommunityService;
|
||||
private final ITbBuildingService tbBuildingService;
|
||||
private final ITbUnitService unitService;
|
||||
private final ITbFloorService floorService;
|
||||
|
||||
@Override
|
||||
@@ -72,20 +68,6 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l2);
|
||||
|
||||
List<TbUnitVo> tbUnitVos = unitService.queryAll();
|
||||
if (tbUnitVos == null || tbUnitVos.isEmpty()) {
|
||||
return treeList;
|
||||
}
|
||||
List<TreeNode<Long>> l3 = tbUnitVos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(3);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getBuildingId());
|
||||
node.setLabel(item.getUnitName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l3);
|
||||
List<TbFloorVo> tbFloorVos = floorService.queryAll();
|
||||
if (tbFloorVos == null || tbFloorVos.isEmpty()) {
|
||||
return treeList;
|
||||
@@ -94,7 +76,7 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(4);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getUnitId());
|
||||
node.setParentCode(item.getBuildingId());
|
||||
node.setLabel(item.getFloorName());
|
||||
return node;
|
||||
}).toList();
|
||||
@@ -109,7 +91,7 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
* @return 楼层
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteFloorVo> queryByBuildingId(Long buildingId){
|
||||
public List<RemoteFloorVo> queryByBuildingId(Long buildingId) {
|
||||
List<TbFloorVo> tbFloorVo = floorService.queryByBuildingId(buildingId);
|
||||
List<RemoteFloorVo> remoteFloorVos = new ArrayList<>();
|
||||
|
||||
|
@@ -156,7 +156,7 @@ public class DepotLogServiceImpl implements IDepotLogService {
|
||||
}
|
||||
|
||||
depotLogVo.setAssetName(CollUtil.isNotEmpty(assetNamesByIds)?assetNamesByIds.get(depotLogVo.getAssetId()):null);
|
||||
depotLogVo.setDepotName(CollUtil.isNotEmpty(depotNamesByIds)?depotNamesByIds.get(depotLogVo.getDepotName()):null);
|
||||
depotLogVo.setDepotName(CollUtil.isNotEmpty(depotNamesByIds)?depotNamesByIds.get(depotLogVo.getDepotId()):null);
|
||||
depotLogVo.setUserName(CollUtil.isNotEmpty(userNamesByIds)?userNamesByIds.get(depotLogVo.getUserId()):remoteUserService.selectNicknameById(depotLogVo.getUserId()));
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -12,7 +14,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.InspectionRoute;
|
||||
import org.dromara.property.domain.InspectionRoutePoint;
|
||||
import org.dromara.property.domain.bo.InspectionRouteBo;
|
||||
import org.dromara.property.domain.bo.InspectionRoutePointBo;
|
||||
import org.dromara.property.domain.vo.InspectionPointVo;
|
||||
import org.dromara.property.domain.vo.InspectionRoutePointVo;
|
||||
import org.dromara.property.domain.vo.InspectionRouteVo;
|
||||
import org.dromara.property.mapper.InspectionPointMapper;
|
||||
import org.dromara.property.mapper.InspectionRouteMapper;
|
||||
import org.dromara.property.mapper.InspectionRoutePointMapper;
|
||||
import org.dromara.property.service.IInspectionRouteService;
|
||||
@@ -37,6 +43,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
|
||||
private final InspectionRouteMapper baseMapper;
|
||||
private final InspectionRoutePointMapper routePointMapper;
|
||||
private final InspectionPointMapper pointMapper;
|
||||
|
||||
/**
|
||||
* 查询巡检路线
|
||||
@@ -45,8 +52,11 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
* @return 巡检路线
|
||||
*/
|
||||
@Override
|
||||
public InspectionRouteVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
public InspectionRouteVo queryById(Long id) {
|
||||
InspectionRouteVo inspectionRouteVo= baseMapper.selectVoById(id);
|
||||
List<InspectionPointVo> inspectionPointVoList = pointMapper.selectVoList();
|
||||
processingData(inspectionRouteVo,inspectionPointVoList);
|
||||
return inspectionRouteVo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,6 +70,11 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
public TableDataInfo<InspectionRouteVo> queryPageList(InspectionRouteBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<InspectionRoute> lqw = buildQueryWrapper(bo);
|
||||
Page<InspectionRouteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<InspectionPointVo> inspectionPointVoList = pointMapper.selectVoList();
|
||||
result.getRecords().stream().forEach(s->{
|
||||
processingData(s,inspectionPointVoList);
|
||||
});
|
||||
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -84,6 +99,20 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*/
|
||||
private void processingData(InspectionRouteVo inspectionRouteVo, List<InspectionPointVo> inspectionPointVoList) {
|
||||
LambdaQueryWrapper<InspectionRoutePoint> routePointLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
routePointLambdaQueryWrapper.eq(InspectionRoutePoint::getRouteId, inspectionRouteVo.getId());
|
||||
List<InspectionRoutePointVo> inspectionRoutePointVoList = routePointMapper.selectVoList(routePointLambdaQueryWrapper);
|
||||
inspectionRoutePointVoList.stream().forEach(s->{
|
||||
InspectionPointVo inspectionPointVo = inspectionPointVoList.stream().filter(vo -> vo.getId() != null && vo.getId().equals(s.getPointId())).findFirst().orElse(null);
|
||||
s.setPointName(ObjectUtil.isNotEmpty(inspectionPointVo)? inspectionPointVo.getPointName():null);
|
||||
});
|
||||
inspectionRouteVo.setInspectionRoutePointVoList(inspectionRoutePointVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增巡检路线
|
||||
*
|
||||
@@ -99,12 +128,12 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream()
|
||||
.map(pointBo -> {
|
||||
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
|
||||
point.setRouteId(add.getId());
|
||||
return point;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.map(pointBo -> {
|
||||
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
|
||||
point.setRouteId(add.getId());
|
||||
return point;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
routePointMapper.insertBatch(routePointList);
|
||||
}
|
||||
return flag;
|
||||
@@ -120,17 +149,36 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionRouteBo bo) {
|
||||
InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class);
|
||||
validEntityBeforeSave(update);
|
||||
validEntityBeforeUpdate(bo);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(InspectionRoute entity){
|
||||
private void validEntityBeforeSave(InspectionRoute entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeUpdate(InspectionRouteBo bo) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
LambdaQueryWrapper<InspectionRoutePoint> routePointLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
routePointLambdaQueryWrapper.eq(InspectionRoutePoint::getRouteId, bo.getId());
|
||||
routePointMapper.delete(routePointLambdaQueryWrapper);
|
||||
List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream()
|
||||
.map(pointBo -> {
|
||||
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
|
||||
point.setRouteId(bo.getId());
|
||||
return point;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
routePointMapper.insertBatch(routePointList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除巡检路线信息
|
||||
*
|
||||
@@ -141,7 +189,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -43,7 +45,7 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
|
||||
* @return 【工单类型】
|
||||
*/
|
||||
@Override
|
||||
public ServiceWorkOrdersTypeVo queryById(Long id){
|
||||
public ServiceWorkOrdersTypeVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -81,6 +83,8 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
|
||||
lqw.like(StringUtils.isNotBlank(bo.getOrderTypeName()), ServiceWorkOrdersType::getOrderTypeName, bo.getOrderTypeName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperationMode()), ServiceWorkOrdersType::getOperationMode, bo.getOperationMode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSearchValue()), ServiceWorkOrdersType::getSearchValue, bo.getSearchValue());
|
||||
lqw.isNull(bo.getFilterSubNodes() != null && bo.getFilterSubNodes(), ServiceWorkOrdersType::getParentId);
|
||||
lqw.ne(bo.getExcludeId()!=null,ServiceWorkOrdersType::getId,bo.getExcludeId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -120,7 +124,7 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ServiceWorkOrdersType entity){
|
||||
private void validEntityBeforeSave(ServiceWorkOrdersType entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -134,7 +138,11 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<ServiceWorkOrdersType>().in(ServiceWorkOrdersType::getParentId, ids));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("当前工单类型下存在子级类型,无法直接删除。");
|
||||
}
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
@@ -142,18 +150,20 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
|
||||
|
||||
/**
|
||||
* 查询【工单类型】树结构
|
||||
*
|
||||
* @return 工单类型树结构
|
||||
*/
|
||||
@Override
|
||||
public List<ServiceWorkOrdersTypeVo> typeTree() {
|
||||
List<ServiceWorkOrdersTypeVo> list = baseMapper.selectVoList();
|
||||
return buildTree(list,null);
|
||||
return buildTree(list, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归构建树结构
|
||||
* @param types 所有类型列表
|
||||
*
|
||||
* @param types 所有类型列表
|
||||
* @param parentId 父节点id
|
||||
* @return 树结构列表
|
||||
*/
|
||||
|
@@ -6,10 +6,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sis.sdk.unview.model.UvModel;
|
||||
import org.dromara.sis.sdk.unview.service.VideoAlarmService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 宇视告警书记上报
|
||||
@@ -20,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/uniview")
|
||||
@RequestMapping("/alarm")
|
||||
public class VideoAlarmController {
|
||||
|
||||
@Resource
|
||||
@@ -34,5 +31,10 @@ public class VideoAlarmController {
|
||||
return UvModel.UniViewResult.success(null);
|
||||
}
|
||||
|
||||
@PostMapping("/huawei/callback")
|
||||
public void huaweiAlarm(@RequestBody String data) {
|
||||
log.info("华为上报消息,msg={}", data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package org.dromara.sis.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联对象 sis_ac_device_ref
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_ac_device_ref")
|
||||
public class SisAcDeviceRef extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 门禁设备id
|
||||
*/
|
||||
private Long acId;
|
||||
|
||||
/**
|
||||
* 监控点设备id
|
||||
*/
|
||||
private Long dpId;
|
||||
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package org.dromara.sis.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联业务对象 sis_ac_device_ref
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisAcDeviceRef.class, reverseConvertGenerate = false)
|
||||
public class SisAcDeviceRefBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 门禁设备id
|
||||
*/
|
||||
@NotNull(message = "门禁设备id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long acId;
|
||||
|
||||
/**
|
||||
* 监控点设备id
|
||||
*/
|
||||
@NotNull(message = "监控点设备id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long dpId;
|
||||
|
||||
|
||||
}
|
@@ -10,6 +10,8 @@ import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.sis.domain.SisAccessControl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门禁设备业务对象 sis_access_control
|
||||
*
|
||||
@@ -104,4 +106,9 @@ public class SisAccessControlBo extends BaseEntity {
|
||||
*/
|
||||
private Long bindDeviceId;
|
||||
|
||||
/**
|
||||
* 监控点列表
|
||||
*/
|
||||
private List<Long> devicePoint;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package org.dromara.sis.domain.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class SisAcDevice extends SisDeviceManage {
|
||||
|
||||
private Long acId;
|
||||
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联视图对象 sis_ac_device_ref
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisAcDeviceRef.class)
|
||||
public class SisAcDeviceRefVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 门禁设备id
|
||||
*/
|
||||
@ExcelProperty(value = "门禁设备id")
|
||||
private Long acId;
|
||||
|
||||
/**
|
||||
* 监控点设备id
|
||||
*/
|
||||
@ExcelProperty(value = "监控点设备id")
|
||||
private Long dpId;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
import org.dromara.sis.domain.model.SisAcDevice;
|
||||
import org.dromara.sis.domain.vo.SisAcDeviceRefVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联Mapper接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
public interface SisAcDeviceRefMapper extends BaseMapperPlus<SisAcDeviceRef, SisAcDeviceRefVo> {
|
||||
|
||||
/**
|
||||
* 通过门禁id列表查询设备信息
|
||||
*
|
||||
* @param acIds 门禁设备id
|
||||
* @return 查询数据
|
||||
*/
|
||||
List<SisAcDevice> queryByAcIds(List<Long> acIds);
|
||||
}
|
@@ -36,5 +36,5 @@ public interface HuaWeiBoxApi {
|
||||
* @param base64Img 入参
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
HWResult findPerson(String base64Img);
|
||||
HWResult<Long> findPerson(String base64Img);
|
||||
}
|
||||
|
@@ -10,9 +10,12 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class HWResult {
|
||||
public class HWResult<T> {
|
||||
|
||||
public Integer code;
|
||||
|
||||
public String message;
|
||||
|
||||
public T data;
|
||||
|
||||
}
|
||||
|
@@ -13,9 +13,7 @@ import org.dromara.sis.sdk.huawei.utils.HuaWeiHttp;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -89,7 +87,7 @@ public class HuaWeiBoxApiService implements HuaWeiBoxApi {
|
||||
* @return Long
|
||||
*/
|
||||
@Override
|
||||
public HWResult findPerson(String base64Img) {
|
||||
public HWResult<Long> findPerson(String base64Img) {
|
||||
String url = "/sdk_service/rest/facerepositories/peoples";
|
||||
|
||||
FinaHWPersonReq req = new FinaHWPersonReq();
|
||||
@@ -103,9 +101,9 @@ public class HuaWeiBoxApiService implements HuaWeiBoxApi {
|
||||
|
||||
if (jsonRes.getInt("resultCode") != 0) {
|
||||
return switch (jsonRes.getInt("resultCode")) {
|
||||
case 912322041 -> new HWResult(912322041, "特征值提取失败");
|
||||
case 912333003 -> new HWResult(912333003, "base64参数非法");
|
||||
default -> new HWResult(jsonRes.getInt("resultCode"), jsonRes.getStr("resultMsg"));
|
||||
case 912322041 -> new HWResult<>(912322041, "特征值提取失败", 0L);
|
||||
case 912333003 -> new HWResult<>(912333003, "base64参数非法", 0L);
|
||||
default -> new HWResult<>(jsonRes.getInt("resultCode"), jsonRes.getStr("resultMsg"), 0L);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -114,12 +112,12 @@ public class HuaWeiBoxApiService implements HuaWeiBoxApi {
|
||||
|
||||
if (Integer.parseInt(obj.getStr("number")) == 0) {
|
||||
log.info("无人脸比对数据");
|
||||
return new HWResult(201, "无匹配数据");
|
||||
return new HWResult<>(201, "无人脸比对数据", 0L);
|
||||
}
|
||||
|
||||
JSONArray peopleList = obj.getJSONArray("peopleList");
|
||||
JSONObject people = peopleList.getJSONObject(0);
|
||||
|
||||
return new HWResult(200, people.getStr("peopleId"));
|
||||
return new HWResult<>(200, "ok", people.getLong("peopleId"));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,94 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.bo.SisAcDeviceRefBo;
|
||||
import org.dromara.sis.domain.model.SisAcDevice;
|
||||
import org.dromara.sis.domain.vo.SisAcDeviceRefVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联Service接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
public interface ISisAcDeviceRefService {
|
||||
|
||||
/**
|
||||
* 查询门禁⇄监控点关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 门禁⇄监控点关联
|
||||
*/
|
||||
SisAcDeviceRefVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询门禁⇄监控点关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 门禁⇄监控点关联分页列表
|
||||
*/
|
||||
TableDataInfo<SisAcDeviceRefVo> queryPageList(SisAcDeviceRefBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的门禁⇄监控点关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 门禁⇄监控点关联列表
|
||||
*/
|
||||
List<SisAcDeviceRefVo> queryList(SisAcDeviceRefBo bo);
|
||||
|
||||
/**
|
||||
* 新增门禁⇄监控点关联
|
||||
*
|
||||
* @param bo 门禁⇄监控点关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisAcDeviceRefBo bo);
|
||||
|
||||
/**
|
||||
* 修改门禁⇄监控点关联
|
||||
*
|
||||
* @param bo 门禁⇄监控点关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisAcDeviceRefBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除门禁⇄监控点关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 通过 门禁设备id 删除 门禁和设备的关联关系
|
||||
*
|
||||
* @param acId 门禁设备id
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteByAcId(Long acId);
|
||||
|
||||
/**
|
||||
* 批量写入关联关系
|
||||
*
|
||||
* @param refs 写入数据
|
||||
* @return 返回是否写入成功
|
||||
*/
|
||||
Boolean batchInsert(List<SisAcDeviceRef> refs);
|
||||
|
||||
/**
|
||||
* 通过acids查询关联记录
|
||||
* @param acIds 门禁id列表
|
||||
* @return 返回查询数据
|
||||
*/
|
||||
List<SisAcDevice> queryByAcIds(List<Long> acIds);
|
||||
}
|
@@ -69,6 +69,6 @@ public interface ISisAlarmEventsService {
|
||||
/**
|
||||
* 异步生成告警记录
|
||||
*/
|
||||
void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg);
|
||||
void createAlarmRecord(String deviceIp, Integer level, Integer type, String msg, byte[] smallImg, byte[] bigImg);
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,151 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.bo.SisAcDeviceRefBo;
|
||||
import org.dromara.sis.domain.model.SisAcDevice;
|
||||
import org.dromara.sis.domain.vo.SisAcDeviceRefVo;
|
||||
import org.dromara.sis.mapper.SisAcDeviceRefMapper;
|
||||
import org.dromara.sis.service.ISisAcDeviceRefService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 门禁⇄监控点关联Service业务层处理
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisAcDeviceRefServiceImpl implements ISisAcDeviceRefService {
|
||||
|
||||
private final SisAcDeviceRefMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询门禁⇄监控点关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 门禁⇄监控点关联
|
||||
*/
|
||||
@Override
|
||||
public SisAcDeviceRefVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门禁⇄监控点关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 门禁⇄监控点关联分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisAcDeviceRefVo> queryPageList(SisAcDeviceRefBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisAcDeviceRef> lqw = buildQueryWrapper(bo);
|
||||
Page<SisAcDeviceRefVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的门禁⇄监控点关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 门禁⇄监控点关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisAcDeviceRefVo> queryList(SisAcDeviceRefBo bo) {
|
||||
LambdaQueryWrapper<SisAcDeviceRef> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisAcDeviceRef> buildQueryWrapper(SisAcDeviceRefBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisAcDeviceRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAcDeviceRef::getId);
|
||||
lqw.eq(bo.getAcId() != null, SisAcDeviceRef::getAcId, bo.getAcId());
|
||||
lqw.eq(bo.getDpId() != null, SisAcDeviceRef::getDpId, bo.getDpId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门禁⇄监控点关联
|
||||
*
|
||||
* @param bo 门禁⇄监控点关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisAcDeviceRefBo bo) {
|
||||
SisAcDeviceRef add = MapstructUtils.convert(bo, SisAcDeviceRef.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门禁⇄监控点关联
|
||||
*
|
||||
* @param bo 门禁⇄监控点关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisAcDeviceRefBo bo) {
|
||||
SisAcDeviceRef update = MapstructUtils.convert(bo, SisAcDeviceRef.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisAcDeviceRef entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除门禁⇄监控点关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteByAcId(Long acId) {
|
||||
LambdaQueryWrapper<SisAcDeviceRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisAcDeviceRef::getAcId, acId);
|
||||
return baseMapper.delete(lqw) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchInsert(List<SisAcDeviceRef> refs) {
|
||||
return baseMapper.insertBatch(refs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SisAcDevice> queryByAcIds(List<Long> acIds) {
|
||||
return baseMapper.queryByAcIds(acIds);
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -15,16 +16,19 @@ import org.dromara.common.core.utils.TreeUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.sis.domain.SisAcDeviceRef;
|
||||
import org.dromara.sis.domain.SisAccessControl;
|
||||
import org.dromara.sis.domain.SisDeviceBindRef;
|
||||
import org.dromara.sis.domain.bo.SisAccessControlBo;
|
||||
import org.dromara.sis.domain.enums.ControlTypeEnum;
|
||||
import org.dromara.sis.domain.model.SisAcDevice;
|
||||
import org.dromara.sis.domain.vo.SisAccessControlVo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.mapper.SisAccessControlMapper;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.RemoteOpenDoorReq;
|
||||
import org.dromara.sis.sdk.e8.domain.door.res.AuthDoorDeviceFindRes;
|
||||
import org.dromara.sis.service.ISisAcDeviceRefService;
|
||||
import org.dromara.sis.service.ISisAccessControlService;
|
||||
import org.dromara.sis.service.ISisDeviceBindRefService;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
@@ -51,6 +55,7 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
private final ISisDeviceManageService sisDeviceManageService;
|
||||
private final ISisDeviceBindRefService sisDeviceBindRefService;
|
||||
private final ISisAcDeviceRefService sisAcDeviceRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
@@ -135,10 +140,12 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(SisAccessControlBo bo) {
|
||||
SisAccessControl update = MapstructUtils.convert(bo, SisAccessControl.class);
|
||||
sisDeviceBindRefService.deleteByBindId(bo.getId());
|
||||
boolean b = baseMapper.updateById(update) > 0;
|
||||
if (bo.getBindDeviceId() != null) {
|
||||
|
||||
// 检验设备是否存在
|
||||
SisDeviceManageVo sisDeviceManageVo = sisDeviceManageService.queryById(bo.getBindDeviceId());
|
||||
Assert.isTrue(sisDeviceManageVo != null, "设备-{}信息不存在.", bo.getBindDeviceId());
|
||||
// 写入关联关系表中
|
||||
SisDeviceBindRef sisDeviceBindRef = new SisDeviceBindRef();
|
||||
sisDeviceBindRef.setDeviceId(sisDeviceManageVo.getId());
|
||||
@@ -146,11 +153,33 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
sisDeviceBindRef.setDeviceFloorId(sisDeviceManageVo.getFloorId());
|
||||
sisDeviceBindRef.setBindId(bo.getId());
|
||||
sisDeviceBindRef.setControlType(ControlTypeEnum.ACCESS_CONTROL.getCode());
|
||||
// 删除绑定关系
|
||||
sisDeviceBindRefService.deleteByBindId(bo.getId());
|
||||
// 重新构建绑定关系
|
||||
Boolean insert = sisDeviceBindRefService.insert(sisDeviceBindRef);
|
||||
Assert.isTrue(insert, "写入设备关联表失败!");
|
||||
}
|
||||
|
||||
return baseMapper.updateById(update) > 0;
|
||||
if (CollUtil.isNotEmpty(bo.getDevicePoint())) {
|
||||
// 检测设备是否存在
|
||||
List<SisAcDeviceRef> refs = new ArrayList<>(bo.getDevicePoint().size());
|
||||
bo.getDevicePoint().forEach(devicePoint -> {
|
||||
// 暂时放弃设备校验
|
||||
// SisDeviceManageVo sisDeviceManageVo = sisDeviceManageService.queryById(bo.getBindDeviceId());
|
||||
// Assert.isTrue(sisDeviceManageVo != null, "设备-{}信息不存在.", bo.getBindDeviceId());
|
||||
SisAcDeviceRef ref = new SisAcDeviceRef();
|
||||
ref.setAcId(bo.getId());
|
||||
ref.setDpId(devicePoint);
|
||||
refs.add(ref);
|
||||
});
|
||||
// 删除原始的关联关系
|
||||
Boolean b1 = sisAcDeviceRefService.deleteByAcId(bo.getId());
|
||||
log.info("门禁-监控关联关系删除完成, result={}, acId={}", b1, bo.getId());
|
||||
// 构建新的关联关系
|
||||
Boolean b2 = sisAcDeviceRefService.batchInsert(refs);
|
||||
log.info("门禁-监控设备关联关系构建完成, result={}", b2);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +218,9 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
// 查询所有的门禁
|
||||
List<SisAccessControlVo> sisAccessControlVos = baseMapper.selectVoList();
|
||||
if (sisAccessControlVos != null && !sisAccessControlVos.isEmpty()) {
|
||||
List<Long> acIds = new ArrayList<>(sisAccessControlVos.size());
|
||||
List<TreeNode<Long>> l1 = sisAccessControlVos.stream().map(item -> {
|
||||
acIds.add(item.getId());
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(5);
|
||||
node.setCode(item.getId());
|
||||
@@ -198,6 +229,18 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
return node;
|
||||
}).toList();
|
||||
treeNodes.addAll(l1);
|
||||
|
||||
// 查询所有的监控点
|
||||
List<SisAcDevice> refs = sisAcDeviceRefService.queryByAcIds(acIds);
|
||||
List<TreeNode<Long>> l2 = refs.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(6);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getAcId());
|
||||
node.setLabel(item.getDeviceName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeNodes.addAll(l2);
|
||||
}
|
||||
return TreeUtils.build(treeNodes, 0L);
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
@Async
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type,String msg, byte[] smallImg, byte[] bigImg) {
|
||||
// 校验设备信息
|
||||
SisDeviceManage sisDeviceManage = deviceManageService.queryByDeviceIp(deviceIp);
|
||||
if (sisDeviceManage == null) {
|
||||
|
@@ -8,11 +8,13 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.sis.domain.vo.*;
|
||||
import org.dromara.sis.producer.CleanLiftAuthRocketProducer;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.RemoteOpenDoorReq;
|
||||
import org.dromara.sis.sdk.hik.HikApiService;
|
||||
import org.dromara.sis.sdk.huawei.HuaWeiBoxApi;
|
||||
import org.dromara.sis.sdk.huawei.domain.HWResult;
|
||||
import org.dromara.sis.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -41,6 +43,8 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
private final ISisAlarmEventsService alarmEventsService;
|
||||
|
||||
private final CleanLiftAuthRocketProducer cleanLiftAuthRocketProducer;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
|
||||
@@ -49,30 +53,35 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
TimeInterval interval = new TimeInterval();
|
||||
// 抓拍小图
|
||||
String smallImgBase64Str = Base64Encoder.encode(smallImg);
|
||||
Long person = huaWeiBoxApi.findPerson(smallImgBase64Str);
|
||||
log.info("人脸比对执行完成,耗时:{}ms", interval);
|
||||
if (person == null) {
|
||||
log.info("未命中人脸数据,暂不处理。");
|
||||
HWResult<Long> result = huaWeiBoxApi.findPerson(smallImgBase64Str);
|
||||
if (result.getCode() == 0) {
|
||||
log.info("华为盒子比对失败,msg={}", result.getMessage());
|
||||
// 产生告警数据
|
||||
alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "人脸比对失败", smallImg, bigImg);
|
||||
return;
|
||||
}
|
||||
log.info("人脸比对执行完成,耗时:{}ms", interval.intervalMs());
|
||||
Long person = result.getData();
|
||||
// 验证当前人原是否存在授权记录
|
||||
SisAuthRecordVo authRecord = authRecordService.checkAuth(person);
|
||||
log.info("查询人员权限记录完成,耗时={}ms", interval.interval());
|
||||
log.info("查询人员权限记录完成,耗时={}ms", interval.intervalMs());
|
||||
if (authRecord == null) {
|
||||
// todo 产生高危告警记录
|
||||
log.info("当前人脸未授权,暂不处理。");
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
if (DateUtil.compare(now, authRecord.getEndDate()) > 0) {
|
||||
// todo 生成一般告警记录
|
||||
log.info("当前人脸已过期,暂不处理。");
|
||||
log.info("人员[{}]没有授权记录,判定为陌生人", person);
|
||||
// 不是内部人员 产生紧急的告警信息
|
||||
alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "陌生人员入内", smallImg, bigImg);
|
||||
return;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
if (DateUtil.compare(now, authRecord.getEndDate()) > 0) {
|
||||
alarmEventsService.createAlarmRecord(deviceIp, 3, 1, "人员授权信息已过期", smallImg, bigImg);
|
||||
log.info("当前人脸已过期,暂不处理。");
|
||||
return;
|
||||
}
|
||||
// 获取当前设备的绑定设备信息
|
||||
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(deviceIp);
|
||||
log.info("查询设备绑定的梯控/门禁完成,耗时={}ms", interval.interval());
|
||||
log.info("查询设备绑定的梯控/门禁完成,耗时={}ms", interval.intervalMs());
|
||||
|
||||
if (CollUtil.isEmpty(bindRefList)) {
|
||||
log.info("当前报警设备未绑定门禁/梯控,不做处理!");
|
||||
return;
|
||||
@@ -96,21 +105,21 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
if (item.getControlType() == 1) { // 门禁
|
||||
handleAc(item.getDeviceId());
|
||||
} else if (item.getControlType() == 2) { // 电梯外面面板权限
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 2);
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 2, item.getDeviceFloorId());
|
||||
} else if (item.getControlType() == 3) { // 电梯里面的面板
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 3);
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 3, item.getDeviceFloorId());
|
||||
} else {
|
||||
log.info("设备绑定了未知的控制类型[{}],不处理", item.getControlType());
|
||||
}
|
||||
});
|
||||
log.info("权限下发执行完成,耗时:{}ms", interval.interval());
|
||||
log.info("权限下发执行完成,耗时:{}ms", interval.intervalMs());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成告警事件
|
||||
*/
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
alarmEventsService.createAlarmRecord(deviceIp, level, type, smallImg, bigImg);
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, String msg, byte[] smallImg, byte[] bigImg) {
|
||||
alarmEventsService.createAlarmRecord(deviceIp, level, type, msg, smallImg, bigImg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,21 +143,32 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
/**
|
||||
* 验证电梯权限
|
||||
*/
|
||||
public void handleEle(Long deviceId, Long groupId, Integer controlType) {
|
||||
log.info("开始下发梯控权限....");
|
||||
// 获取电梯信息
|
||||
// 获取电梯信息
|
||||
public void handleEle(Long deviceId, Long groupId, Integer controlType, Long deviceFloorId) {
|
||||
|
||||
// 获取当前电梯信息
|
||||
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
|
||||
// 根据单元ID获取楼层信息
|
||||
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByBuildingId(ele.getBuildingId());
|
||||
// 获取电梯⇄楼层关联信息
|
||||
List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByAuthGroupId(groupId);
|
||||
|
||||
for (SisElevatorFloorRefVo sisElevatorFloorRefVo : floorRefList) {
|
||||
//todo 下发梯控权限
|
||||
// HikApiService.getInstance().controlGateway(ele.getControlIp(), sisElevatorFloorRefVo.getFloorId(), 2);
|
||||
// 获取权限组下电梯⇄楼层关联信息
|
||||
List<SisElevatorFloorRefVo> groupRef = elevatorFloorRefService.queryByAuthGroupId(groupId);
|
||||
|
||||
// 取出当前电梯的楼层授权信息
|
||||
List<SisElevatorFloorRefVo> eleRef = groupRef.stream().filter(o -> Objects.equals(o.getElevatorId(), deviceId)).toList();
|
||||
|
||||
for (SisElevatorFloorRefVo ref : eleRef){
|
||||
if (controlType == 2){
|
||||
log.info("开始下发外面版梯控权限....");
|
||||
if (ref.getOutChannel() != null && Objects.equals(ref.getFloorId(), deviceFloorId)) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), ref.getOutChannel().intValue(), 2);
|
||||
}
|
||||
}else {
|
||||
log.info("开始下发里面版梯控权限....");
|
||||
if (ref.getInChannel() != null && Objects.equals(ref.getFloorId(), deviceFloorId)) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), ref.getInChannel().intValue(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("梯控下发权限完成");
|
||||
|
||||
|
||||
cleanLiftAuthRocketProducer.sendMessage(deviceId, groupId, deviceFloorId, "清除电梯" + deviceId + "梯控权限", 3);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.sis.mapper.SisAcDeviceRefMapper">
|
||||
|
||||
<select id="queryByAcIds" resultType="org.dromara.sis.domain.model.SisAcDevice">
|
||||
SELECT
|
||||
b.*,
|
||||
a.ac_id
|
||||
FROM
|
||||
sis_ac_device_ref a
|
||||
LEFT JOIN sis_device_manage b ON a.dp_id = b.id
|
||||
where a.ac_id IN
|
||||
<foreach collection="acIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user