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:
@@ -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);
|
||||
|
||||
}
|
@@ -21,10 +21,10 @@ public interface RemoteFloorService {
|
||||
List<TreeNode<Long>> queryTreeList();
|
||||
|
||||
/**
|
||||
* 根据单元ID查询楼层
|
||||
* 根据楼层id查询楼层
|
||||
*
|
||||
* @param unitId 单元ID
|
||||
* @param buildingId 单元ID
|
||||
* @return 楼层
|
||||
*/
|
||||
List<RemoteFloorVo> queryByUnitId(Long unitId);
|
||||
List<RemoteFloorVo> queryByBuildingId(Long buildingId);
|
||||
}
|
||||
|
@@ -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
|
||||
*/
|
||||
@Data
|
||||
public class RemoteUnitVo implements Serializable {
|
||||
public class RemoteBuildingVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -11L;
|
||||
@@ -21,31 +21,19 @@ public class RemoteUnitVo implements Serializable {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 园区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
private Long buildingId;
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
* 总层数
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 单元层数
|
||||
*/
|
||||
private Integer floorCount;
|
||||
|
||||
/**
|
||||
* 单元户数
|
||||
*/
|
||||
private Integer householdCount;
|
||||
|
||||
/**
|
||||
* 楼梯数量
|
||||
*/
|
||||
private Integer stairCount;
|
||||
private Long floorCount;
|
||||
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
package org.dromara.resource.api;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
|
||||
@@ -22,6 +21,14 @@ public interface RemoteFileService {
|
||||
*/
|
||||
RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) throws ServiceException;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param file 文件信息
|
||||
* @return 结果
|
||||
* @throws ServiceException
|
||||
*/
|
||||
RemoteFile uploadImg(byte[] file) throws ServiceException;
|
||||
|
||||
/**
|
||||
* 通过ossId查询对应的url
|
||||
*
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.resource.api;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
|
||||
@@ -28,6 +29,18 @@ public class RemoteFileServiceMock implements RemoteFileService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param file 文件信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public RemoteFile uploadImg(byte[] file) {
|
||||
log.warn("服务调用异常 -> 降级处理");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ossId查询对应的url
|
||||
*
|
||||
|
@@ -0,0 +1,76 @@
|
||||
package org.dromara.common.core.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote ContentTypeEnum
|
||||
* @since 2025/8/4
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ContentTypeEnum {
|
||||
|
||||
/**
|
||||
* JPEG图片类型
|
||||
*/
|
||||
JPG("jpg", "image/jpeg"),
|
||||
|
||||
/**
|
||||
* JPEG图片类型
|
||||
*/
|
||||
JPEG("jpeg", "image/jpeg"),
|
||||
|
||||
/**
|
||||
* PNG图片类型
|
||||
*/
|
||||
PNG("png", "image/png"),
|
||||
|
||||
/**
|
||||
* GIF图片类型
|
||||
*/
|
||||
GIF("gif", "image/gif"),
|
||||
|
||||
WEBP("webp", "image/webp"),
|
||||
|
||||
SVG("svg", "image/svg+xml"),
|
||||
|
||||
;
|
||||
|
||||
private final String extension;
|
||||
private final String contentType;
|
||||
|
||||
/**
|
||||
* 根据文件扩展名获取内容类型
|
||||
*
|
||||
* @param extension 文件扩展名
|
||||
* @return 对应的内容类型,如果未找到则返回null
|
||||
*/
|
||||
public static ContentTypeEnum ContentTypeEnum(String extension) {
|
||||
for (ContentTypeEnum type : values()) {
|
||||
if (type.extension.equalsIgnoreCase(extension)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return JPG;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名
|
||||
*
|
||||
* @return 文件扩展名
|
||||
*/
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内容类型
|
||||
*
|
||||
* @return 内容类型
|
||||
*/
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package org.dromara.common.core.enums;
|
||||
|
||||
/**
|
||||
* 常用文件的文件头如下:(以前六位为准)
|
||||
* JPEG (jpg),文件头:FFD8FF
|
||||
* PNG (png),文件头:89504E47
|
||||
* GIF (gif),文件头:47494638
|
||||
* TIFF (tif),文件头:49492A00
|
||||
* Windows Bitmap (bmp),文件头:424D
|
||||
* CAD (dwg),文件头:41433130
|
||||
* Adobe Photoshop (psd),文件头:38425053
|
||||
* Rich Text Format (rtf),文件头:7B5C727466
|
||||
* XML (xml),文件头:3C3F786D6C
|
||||
* HTML (html),文件头:68746D6C3E
|
||||
* Email [thorough only] (eml),文件头:44656C69766572792D646174653A
|
||||
* Outlook Express (dbx),文件头:CFAD12FEC5FD746F
|
||||
* Outlook (pst),文件头:2142444E
|
||||
* MS Word/Excel (xls.or.doc),文件头:D0CF11E0
|
||||
* MS Access (mdb),文件头:5374616E64617264204A
|
||||
* WordPerfect (wpd),文件头:FF575043
|
||||
* Postscript (eps.or.ps),文件头:252150532D41646F6265
|
||||
* Adobe Acrobat (pdf),文件头:255044462D312E
|
||||
* Quicken (qdf),文件头:AC9EBD8F
|
||||
* Windows Password (pwl),文件头:E3828596
|
||||
* ZIP Archive (zip),文件头:504B0304
|
||||
* RAR Archive (rar),文件头:52617221
|
||||
* Wave (wav),文件头:57415645
|
||||
* AVI (avi),文件头:41564920
|
||||
* Real Audio (ram),文件头:2E7261FD
|
||||
* Real Media (rm),文件头:2E524D46
|
||||
* MPEG (mpg),文件头:000001BA
|
||||
* MPEG (mpg),文件头:000001B3
|
||||
* Quicktime (mov),文件头:6D6F6F76
|
||||
* Windows Media (asf),文件头:3026B2758E66CF11
|
||||
* MIDI (mid),文件头:4D546864
|
||||
*/
|
||||
public enum ImageType {
|
||||
JPEG("jpg", "FFD8FF"),
|
||||
PNG("png","89504E47"),
|
||||
Windows_Bitmap("bmp","424D"),
|
||||
|
||||
GIF("gif","47494638"),
|
||||
TIFF("tif","49492A00"),
|
||||
CAD("dwg","41433130"),
|
||||
Adobe_Photoshop("psd","38425053"),
|
||||
XML("xml","3C3F786D6C"),
|
||||
HTML("html","68746D6C3E"),
|
||||
Adobe_Acrobat("pdf","255044462D312E"),
|
||||
ZIP_Archive("zip","504B0304"),
|
||||
RAR_Archive("rar","52617221"),
|
||||
Wave("wav","57415645"),
|
||||
AVI("avi","41564920");
|
||||
|
||||
private final String suffix;
|
||||
private final String headCode;
|
||||
|
||||
ImageType(String suffix, String headCode) {
|
||||
this.suffix = suffix;
|
||||
this.headCode = headCode;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public String getHeadCode() {
|
||||
return headCode;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,147 @@
|
||||
package org.dromara.common.core.utils;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.enums.ImageType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* [base64 加密解密工具类]
|
||||
*
|
||||
* @author : [lxj]
|
||||
* @version : [v1.0]
|
||||
* @createTime : [2021/4/27 12:54]
|
||||
*/
|
||||
@Slf4j
|
||||
public class Base64Utils {
|
||||
|
||||
|
||||
public Base64Utils(){}
|
||||
/**
|
||||
* 文件路径转base64
|
||||
* @param path 文件路径
|
||||
* @return 如果成功返回base64 字符串,否则返回null
|
||||
*/
|
||||
public static String file2Base64(String path){
|
||||
File f = new File(path);
|
||||
if(f.exists()){
|
||||
return file2Base64(f);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件转base64
|
||||
* @param filePath 文件对象
|
||||
* @return 如果成功返回base64 字符串,否则返回null
|
||||
*/
|
||||
public static String file2Base64(File filePath){
|
||||
return file2Base64(filePath.toPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件转base64
|
||||
* @param p Path 对象
|
||||
* @return 如果成功返回base64 字符串,否则返回null
|
||||
*/
|
||||
public static String file2Base64(Path p) {
|
||||
try {
|
||||
byte[] b = Files.readAllBytes(p);
|
||||
return byte2Base64(b);
|
||||
} catch (IOException e) {
|
||||
log.error("文件转base64失败, msg:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入流转base64
|
||||
* @param inputStream 输入流
|
||||
* @return 如果成功返回base64 字符串,否则返回null
|
||||
*/
|
||||
public static String stream2Base64(InputStream inputStream){
|
||||
try {
|
||||
byte [] b = IoUtil.readBytes(inputStream);
|
||||
return byte2Base64(b);
|
||||
} catch (Exception e) {
|
||||
log.error("输入流转base64失败, msg:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数组转base64
|
||||
* @param b 字节数组
|
||||
* @return
|
||||
*/
|
||||
public static String byte2Base64(byte [] b){
|
||||
assert b != null && b.length > 0;
|
||||
return Base64.getEncoder().encodeToString(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过文件的base计算文件的格式
|
||||
* @param base64 文件的base64
|
||||
* @return
|
||||
*/
|
||||
public static String getType(String base64){
|
||||
byte[] b = Base64.getDecoder().decode(base64);
|
||||
return getType(b);
|
||||
}
|
||||
|
||||
public static String getType(byte [] b){
|
||||
try {
|
||||
String xxx = bytesToHexString(b);
|
||||
assert xxx != null && !xxx.isEmpty();
|
||||
ImageType[] types = ImageType.values();
|
||||
String suffix = null;
|
||||
for (ImageType type: types) {
|
||||
if(xxx.toUpperCase().startsWith(type.getHeadCode())){
|
||||
suffix = type.getSuffix();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return suffix;
|
||||
}catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断文件格式 取前6个字符来进行判断
|
||||
* @param src 文件字节数组
|
||||
* @return 返回文件字节数组前6位编码
|
||||
*/
|
||||
public static String bytesToHexString(byte[] src) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int pifNum = 10;
|
||||
if (src == null || src.length <= pifNum) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < pifNum; i ++) {
|
||||
int v = src[i] & 0xFF;
|
||||
String hv = Integer.toHexString(v);
|
||||
if (hv.length() < 2) {
|
||||
stringBuilder.append(0);
|
||||
}
|
||||
stringBuilder.append(hv);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
public static String handleBase64Header(String webBase64Code){
|
||||
String [] s = webBase64Code.split("base64,");
|
||||
if(s.length == 2){
|
||||
return s[1];
|
||||
}
|
||||
return webBase64Code;
|
||||
}
|
||||
|
||||
}
|
@@ -105,14 +105,14 @@ public class TbFloorController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单元ID查询楼层
|
||||
* 根据楼层id查询楼层
|
||||
*
|
||||
* @param unitId 单元ID
|
||||
* @param buildingId 单元ID
|
||||
* @return 楼层
|
||||
*/
|
||||
@GetMapping("/queryByUnitId/{unitId}")
|
||||
public R<List<TbFloorVo>> queryByUnitId(@NotNull(message = "单元ID不能为空")
|
||||
@PathVariable("unitId") Long unitId) {
|
||||
return R.ok(tbFloorService.queryByUnitId(unitId));
|
||||
@GetMapping("/queryByBuildingId/{buildingId}")
|
||||
public R<List<TbFloorVo>> queryByBuildingId(@NotNull(message = "楼层ID不能为空")
|
||||
@PathVariable("buildingId") Long buildingId) {
|
||||
return R.ok(tbFloorService.queryByBuildingId(buildingId));
|
||||
}
|
||||
}
|
||||
|
@@ -101,6 +101,10 @@ public class ServiceWorkOrders extends TenantEntity {
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -90,11 +90,6 @@ public class CleanOrderBo extends BaseEntity {
|
||||
@NotBlank(message = "结束时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
@NotNull(message = "单位id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
/**
|
||||
* 评价
|
||||
*/
|
||||
|
@@ -48,6 +48,11 @@ public class ServiceWorkOrdersInfoVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "工单类型")
|
||||
private Long type;
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
@ExcelProperty(value = "权重")
|
||||
private String processingWeight;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
@@ -127,6 +132,22 @@ public class ServiceWorkOrdersInfoVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
*工单记录
|
||||
*/
|
||||
|
@@ -131,6 +131,10 @@ public class ServiceWorkOrdersVo implements Serializable {
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 工单图片
|
||||
*/
|
||||
private String orderImgUrl;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ 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;
|
||||
@@ -34,7 +35,6 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
private final ITbUnitService unitService;
|
||||
private final ITbFloorService floorService;
|
||||
|
||||
|
||||
@Override
|
||||
public RemoteFloorVo queryByFloorId(Long floorId) {
|
||||
TbFloorVo tbFloorVo = floorService.queryById(floorId);
|
||||
@@ -103,14 +103,14 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单元ID查询楼层
|
||||
* 根据楼层id查询楼层
|
||||
*
|
||||
* @param unitId 单元ID
|
||||
* @param buildingId 单元ID
|
||||
* @return 楼层
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteFloorVo> queryByUnitId(Long unitId){
|
||||
List<TbFloorVo> tbFloorVo = floorService.queryByUnitId(unitId);
|
||||
public List<RemoteFloorVo> queryByBuildingId(Long buildingId){
|
||||
List<TbFloorVo> tbFloorVo = floorService.queryByBuildingId(buildingId);
|
||||
List<RemoteFloorVo> remoteFloorVos = new ArrayList<>();
|
||||
|
||||
tbFloorVo.forEach(item -> {
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -76,10 +76,10 @@ public interface ITbFloorService {
|
||||
List<TbFloorVo> queryAll();
|
||||
|
||||
/**
|
||||
* 根据单元ID查询楼层
|
||||
* 根据楼层id查询楼层
|
||||
*
|
||||
* @param unitId 单元ID
|
||||
* @param buildingId 单元ID
|
||||
* @return 楼层
|
||||
*/
|
||||
List<TbFloorVo> queryByUnitId(Long unitId);
|
||||
List<TbFloorVo> queryByBuildingId(Long buildingId);
|
||||
}
|
||||
|
@@ -216,6 +216,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
* 修改前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeUpdate(ServiceWorkOrders entity) {
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(entity.getStatus()),"状态不能为空!");
|
||||
LambdaQueryWrapper<ServiceWorkOrdersRecord> ordersLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getOrderId, entity.getId());
|
||||
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getStatus, entity.getStatus());
|
||||
|
@@ -160,15 +160,15 @@ public class TbFloorServiceImpl implements ITbFloorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单元ID查询楼层
|
||||
* 根据楼层id查询楼层
|
||||
*
|
||||
* @param unitId 单元ID
|
||||
* @param buildingId 单元ID
|
||||
* @return 楼层
|
||||
*/
|
||||
@Override
|
||||
public List<TbFloorVo> queryByUnitId(Long unitId) {
|
||||
public List<TbFloorVo> queryByBuildingId(Long buildingId) {
|
||||
LambdaQueryWrapper<TbFloor> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(TbFloor::getUnitId, unitId)
|
||||
lqw.eq(TbFloor::getBuildingId, buildingId)
|
||||
.orderByAsc(TbFloor::getFloorNumber);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
@@ -0,0 +1,107 @@
|
||||
package org.dromara.sis.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventAttachmentsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
import org.dromara.sis.service.ISisAlarmEventAttachmentsService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】
|
||||
* 前端访问路由地址为:/system/alarmEventAttachments
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/alarmEventAttachments")
|
||||
public class SisAlarmEventAttachmentsController extends BaseController {
|
||||
|
||||
private final ISisAlarmEventAttachmentsService sisAlarmEventAttachmentsService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SisAlarmEventAttachmentsVo> list(SisAlarmEventAttachmentsBo bo, PageQuery pageQuery) {
|
||||
return sisAlarmEventAttachmentsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:export")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SisAlarmEventAttachmentsBo bo, HttpServletResponse response) {
|
||||
List<SisAlarmEventAttachmentsVo> list = sisAlarmEventAttachmentsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "【请填写功能名称】", SisAlarmEventAttachmentsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SisAlarmEventAttachmentsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(sisAlarmEventAttachmentsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:add")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisAlarmEventAttachmentsBo bo) {
|
||||
return toAjax(sisAlarmEventAttachmentsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:edit")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisAlarmEventAttachmentsBo bo) {
|
||||
return toAjax(sisAlarmEventAttachmentsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:alarmEventAttachments:remove")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(sisAlarmEventAttachmentsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package org.dromara.sis.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventsBo;
|
||||
import org.dromara.sis.service.ISisAlarmEventsService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 告警
|
||||
* 前端访问路由地址为:/sis/alarmEvents
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/alarmEvents")
|
||||
public class SisAlarmEventsController extends BaseController {
|
||||
|
||||
private final ISisAlarmEventsService sisAlarmEventsService;
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SisAlarmEventsVo> list(SisAlarmEventsBo bo, PageQuery pageQuery) {
|
||||
return sisAlarmEventsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出告警列表
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:export")
|
||||
@Log(title = "告警", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SisAlarmEventsBo bo, HttpServletResponse response) {
|
||||
List<SisAlarmEventsVo> list = sisAlarmEventsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "告警", SisAlarmEventsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取告警详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SisAlarmEventsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(sisAlarmEventsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:add")
|
||||
@Log(title = "告警", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisAlarmEventsBo bo) {
|
||||
return toAjax(sisAlarmEventsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:edit")
|
||||
@Log(title = "告警", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisAlarmEventsBo bo) {
|
||||
return toAjax(sisAlarmEventsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除告警
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("sis:alarmEvents:remove")
|
||||
@Log(title = "告警", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(sisAlarmEventsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package org.dromara.sis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 sis_alarm_event_attachments
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_alarm_event_attachments")
|
||||
public class SisAlarmEventAttachments extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事件id
|
||||
*/
|
||||
private Long eventId;
|
||||
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
*/
|
||||
private Long type;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package org.dromara.sis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 告警对象 sis_alarm_events
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_alarm_events")
|
||||
public class SisAlarmEvents extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 报警记录ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报警事件类型
|
||||
*/
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 报警记录级别(1:一般,2:中级,3:紧急)
|
||||
*/
|
||||
private Long level;
|
||||
|
||||
/**
|
||||
* 报警设备ip
|
||||
*/
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 报警设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备所属区域id
|
||||
*/
|
||||
private Long deviceGroupId;
|
||||
|
||||
/**
|
||||
* 设备所属区域名称
|
||||
*/
|
||||
private String deviceGroupName;
|
||||
|
||||
/**
|
||||
* 设备告警时间
|
||||
*/
|
||||
private Date reportTime;
|
||||
|
||||
/**
|
||||
* 事件状态
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
private Long workOrderId;
|
||||
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
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_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_elevator_floor_channel_ref")
|
||||
public class SisElevatorFloorChannelRef extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -37,4 +37,9 @@ public class SisPersonLib extends TenantEntity {
|
||||
* 人员库描述
|
||||
*/
|
||||
private String libDesc;
|
||||
|
||||
/**
|
||||
* 1:白名单,2:黑名单,3:红名单l
|
||||
*/
|
||||
private Integer libType;
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
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.SisAlarmEventAttachments;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】业务对象 sis_alarm_event_attachments
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisAlarmEventAttachments.class, reverseConvertGenerate = false)
|
||||
public class SisAlarmEventAttachmentsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事件id
|
||||
*/
|
||||
@NotNull(message = "事件id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long eventId;
|
||||
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
*/
|
||||
private Long type;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
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.SisAlarmEvents;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 告警业务对象 sis_alarm_events
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisAlarmEvents.class, reverseConvertGenerate = false)
|
||||
public class SisAlarmEventsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 报警记录ID
|
||||
*/
|
||||
@NotNull(message = "报警记录ID不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报警事件类型
|
||||
*/
|
||||
@NotNull(message = "报警事件类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 报警记录级别(1:一般,2:中级,3:紧急)
|
||||
*/
|
||||
@NotNull(message = "报警记录级别(1:一般,2:中级,3:紧急)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long level;
|
||||
|
||||
/**
|
||||
* 报警设备ip
|
||||
*/
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 报警设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备所属区域id
|
||||
*/
|
||||
private Long deviceGroupId;
|
||||
|
||||
/**
|
||||
* 设备所属区域名称
|
||||
*/
|
||||
private String deviceGroupName;
|
||||
|
||||
/**
|
||||
* 设备告警时间
|
||||
*/
|
||||
@NotNull(message = "设备告警时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Date reportTime;
|
||||
|
||||
/**
|
||||
* 事件状态
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
private Long workOrderId;
|
||||
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package org.dromara.sis.domain.bo;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联业务对象 sis_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisElevatorFloorChannelRef.class, reverseConvertGenerate = false)
|
||||
public class SisElevatorFloorChannelRefBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
@NotNull(message = "楼层id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
@NotNull(message = "电梯id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
* 电梯基本信息业务对象 sis_elevator_info
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-07-10
|
||||
* @since 2025-07-10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -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 {
|
||||
|
@@ -36,4 +36,7 @@ public class SisPersonLibBo extends BaseEntity {
|
||||
* 人员库描述
|
||||
*/
|
||||
private String libDesc;
|
||||
|
||||
private Integer libType;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,52 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】视图对象 sis_alarm_event_attachments
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisAlarmEventAttachments.class)
|
||||
public class SisAlarmEventAttachmentsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事件id
|
||||
*/
|
||||
@ExcelProperty(value = "事件id")
|
||||
private Long eventId;
|
||||
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
@ExcelProperty(value = "时间图片id")
|
||||
private String ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
*/
|
||||
@ExcelProperty(value = "1:图片,2:文件;3视频")
|
||||
private Long type;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.sis.domain.SisAlarmEvents;
|
||||
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 java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 告警视图对象 sis_alarm_events
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisAlarmEvents.class)
|
||||
public class SisAlarmEventsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 报警记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "报警记录ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报警事件类型
|
||||
*/
|
||||
@ExcelProperty(value = "报警事件类型")
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 报警记录级别(1:一般,2:中级,3:紧急)
|
||||
*/
|
||||
@ExcelProperty(value = "报警记录级别(1:一般,2:中级,3:紧急)")
|
||||
private Long level;
|
||||
|
||||
/**
|
||||
* 报警设备ip
|
||||
*/
|
||||
@ExcelProperty(value = "报警设备ip")
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 报警设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "报警设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备所属区域id
|
||||
*/
|
||||
@ExcelProperty(value = "设备所属区域id")
|
||||
private Long deviceGroupId;
|
||||
|
||||
/**
|
||||
* 设备所属区域名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备所属区域名称")
|
||||
private String deviceGroupName;
|
||||
|
||||
/**
|
||||
* 设备告警时间
|
||||
*/
|
||||
@ExcelProperty(value = "设备告警时间")
|
||||
private Date reportTime;
|
||||
|
||||
/**
|
||||
* 事件状态
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
private Long workOrderId;
|
||||
}
|
@@ -54,4 +54,5 @@ public class SisDeviceBindRefVo implements Serializable {
|
||||
private Integer controlType;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
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 java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联视图对象 sis_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisElevatorFloorChannelRef.class)
|
||||
public class SisElevatorFloorChannelRefVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
@ExcelProperty(value = "楼层id")
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
@ExcelProperty(value = "电梯id")
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
@ExcelProperty(value = "内部通道号")
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
@ExcelProperty(value = "外部通道号")
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -43,6 +43,7 @@ public class SisElevatorFloorRefVo implements Serializable {
|
||||
@ExcelProperty(value = "楼层id")
|
||||
private Long floorId;
|
||||
|
||||
|
||||
/**
|
||||
* 授权组id
|
||||
*/
|
||||
|
@@ -159,12 +159,17 @@ public class SisElevatorInfoVo implements Serializable {
|
||||
/**
|
||||
* 呼梯摄像头
|
||||
*/
|
||||
private List<Long> remoteCallElevatorDeviceId;
|
||||
private List<DeviceInfo> remoteCallElevatorDeviceId;
|
||||
|
||||
/**
|
||||
* 梯控摄像头
|
||||
*/
|
||||
private Long elevatorControlDeviceId;
|
||||
private DeviceInfo elevatorControlDeviceId;
|
||||
|
||||
|
||||
@Data
|
||||
public static class DeviceInfo {
|
||||
private Long deviceId;
|
||||
private String deviceIp;
|
||||
}
|
||||
}
|
||||
|
@@ -41,4 +41,6 @@ public class SisPersonLibVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "人员库描述")
|
||||
private String libDesc;
|
||||
|
||||
private Integer libType;
|
||||
}
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface SisAlarmEventAttachmentsMapper extends BaseMapperPlus<SisAlarmEventAttachments, SisAlarmEventAttachmentsVo> {
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.dromara.sis.domain.SisAlarmEvents;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 告警Mapper接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface SisAlarmEventsMapper extends BaseMapperPlus<SisAlarmEvents, SisAlarmEventsVo> {
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Mapper接口
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface SisElevatorFloorChannelRefMapper extends BaseMapperPlus<SisElevatorFloorChannelRef, SisElevatorFloorChannelRefVo> {
|
||||
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.sis.domain.SisElevatorInfo;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@@ -8,8 +9,9 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* 电梯基本信息Mapper接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-07-10
|
||||
* @since 2025-07-10
|
||||
*/
|
||||
@Mapper
|
||||
public interface SisElevatorInfoMapper extends BaseMapperPlus<SisElevatorInfo, SisElevatorInfoVo> {
|
||||
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public class HikDeviceApplicationRunner implements ApplicationRunner {
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
// 模拟登录
|
||||
StpUtil.login(-8);
|
||||
floorInfoRef.set(remoteFloorService.queryByUnitId(item.getUnitId()));
|
||||
floorInfoRef.set(remoteFloorService.queryByBuildingId(item.getBuildingId()));
|
||||
});
|
||||
|
||||
// 根据单元ID获取楼层信息
|
||||
|
@@ -22,13 +22,13 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class E8ApiUtil {
|
||||
|
||||
@Value("e8.url")
|
||||
@Value("${E8Plat.url}")
|
||||
private String BASE_URL;
|
||||
|
||||
@Value("e8.secretKey")
|
||||
@Value("${E8Plat.secretKey}")
|
||||
private String SECRET_KEY;
|
||||
|
||||
@Value("e8.key")
|
||||
@Value("${E8Plat.key}")
|
||||
private String KEY;
|
||||
|
||||
/**
|
||||
|
@@ -1,21 +1,10 @@
|
||||
package org.dromara.sis.sdk.hik.calback;
|
||||
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.sun.jna.Pointer;
|
||||
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.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.RemoteOpenDoorReq;
|
||||
import org.dromara.sis.sdk.hik.HCNetSDK;
|
||||
import org.dromara.sis.sdk.hik.HikApiService;
|
||||
import org.dromara.sis.sdk.huawei.HuaWeiBoxApi;
|
||||
import org.dromara.sis.service.*;
|
||||
import org.dromara.sis.service.IZeroSensationPassageService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -23,12 +12,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static org.dromara.sis.sdk.hik.HCNetSDK.*;
|
||||
|
||||
@@ -37,18 +21,7 @@ import static org.dromara.sis.sdk.hik.HCNetSDK.*;
|
||||
@RequiredArgsConstructor
|
||||
public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
|
||||
|
||||
private final HuaWeiBoxApi huaWeiBoxApi;
|
||||
private final ISisAuthRecordService authRecordService;
|
||||
private final ISisElevatorInfoService elevatorInfoService;
|
||||
private final ISisAuthGroupRefService authGroupRefService;
|
||||
private final ISisDeviceBindRefService deviceBindRefService;
|
||||
private final ISisAccessControlService accessControlService;
|
||||
private final ISisElevatorFloorRefService elevatorFloorRefService;
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
|
||||
private final IZeroSensationPassageService zeroSensationPassageService;
|
||||
|
||||
@Override
|
||||
public boolean invoke(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
||||
@@ -292,132 +265,23 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
|
||||
* @return 返回是否处理成功
|
||||
*/
|
||||
private boolean handleFaceSnap(HCNetSDK.NET_VCA_FACESNAP_RESULT result, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
long s = System.currentTimeMillis();
|
||||
// 读取人脸小图
|
||||
ByteBuffer buffers = result.pBuffer1.getByteBuffer(0, result.dwFacePicLen);
|
||||
byte[] smallImg = new byte[result.dwFacePicLen];
|
||||
buffers.rewind();
|
||||
buffers.get(smallImg);
|
||||
|
||||
// 读取人脸大图
|
||||
/*ByteBuffer buffers1 = result.pBuffer2.getByteBuffer(0, result.dwBackgroundPicLen);
|
||||
// 人脸大图
|
||||
ByteBuffer buffers1 = result.pBuffer2.getByteBuffer(0, result.dwBackgroundPicLen);
|
||||
byte[] bigImg = new byte[result.dwBackgroundPicLen];
|
||||
buffers1.rewind();
|
||||
buffers1.get(bigImg);*/
|
||||
|
||||
buffers1.get(bigImg);
|
||||
//设备ip
|
||||
String sAlarmInfo = new String(pAlarmer.sDeviceIP).trim();
|
||||
// 设备绑定关系
|
||||
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(sAlarmInfo);
|
||||
if (CollUtil.isEmpty(bindRefList)) {
|
||||
log.info("当前报警设备未绑定门禁/梯控,不做处理!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// todo 进行人脸比对
|
||||
String smallImgBase64Str = Base64Encoder.encode(smallImg);
|
||||
long s1 = System.currentTimeMillis();
|
||||
Long person = huaWeiBoxApi.findPerson(smallImgBase64Str);
|
||||
log.info("人脸比对执行完成,耗时:{}", System.currentTimeMillis() - s1);
|
||||
if (person == null) {
|
||||
log.info("未命中人脸数据,暂不处理。");
|
||||
return true;
|
||||
}
|
||||
log.info("人脸比对完成,personId={}", person);
|
||||
|
||||
// TODO 测试逻辑,只针对门禁
|
||||
|
||||
// 授权纪录
|
||||
SisAuthRecordVo authRecord = authRecordService.checkAuth(person);
|
||||
if (authRecord == null) {
|
||||
log.info("当前人脸未授权,暂不处理。");
|
||||
return true;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
if (DateUtil.compare(now, authRecord.getEndDate()) > 0) {
|
||||
log.info("当前人脸已过期,暂不处理。");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 授权设备列表
|
||||
List<SisAuthGroupRefVo> authGroupRefVos = authGroupRefService.queryListByGroupId(authRecord.getGroupId());
|
||||
// 获取门禁id
|
||||
Collection<Long> acIds = authGroupRefVos.stream().filter(vo -> vo.getDeviceType() == 1).map(SisAuthGroupRefVo::getDeviceId).toList();
|
||||
if (CollUtil.isNotEmpty(acIds)) {
|
||||
acIds.forEach(id -> {
|
||||
// controlType 1-门禁
|
||||
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id) && vo.getControlType() == 1).findFirst().map(SisDeviceBindRefVo::getBindId).orElse(null);
|
||||
if (deviceId != null) {
|
||||
SisAccessControlVo ac = accessControlService.queryById(deviceId);
|
||||
log.info("调用门禁服务远程开门,doorName:{}", ac.getAccessName());
|
||||
RemoteOpenDoorReq req = new RemoteOpenDoorReq();
|
||||
req.setType(0);
|
||||
RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
|
||||
data.setDeviceId(Long.parseLong(ac.getOutCode()));
|
||||
data.setDoorId(Long.parseLong(ac.getOutCode()));
|
||||
req.setControlList(List.of(data));
|
||||
Boolean flag = e8PlatformApi.remoteOpenDoor(req);
|
||||
log.info("远程开门结果,result={}", flag);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取电梯ids
|
||||
Collection<Long> eleIds = authGroupRefVos.stream().filter(vo -> vo.getDeviceType() == 2).map(SisAuthGroupRefVo::getDeviceId).toList();
|
||||
if (CollUtil.isNotEmpty(eleIds)) {
|
||||
|
||||
// 创建线程池,处理关闭梯控
|
||||
int optimalPoolSize = Runtime.getRuntime().availableProcessors() + 1;
|
||||
ExecutorService executor = Executors.newFixedThreadPool(optimalPoolSize);
|
||||
|
||||
eleIds.forEach(id -> {
|
||||
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id) && vo.getControlType() != 1).findFirst().map(SisDeviceBindRefVo::getBindId).orElse(null);
|
||||
if (deviceId != null) {
|
||||
log.info("下发电梯权限");
|
||||
// 获取电梯信息
|
||||
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
|
||||
// 根据单元ID获取楼层信息
|
||||
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(deviceId);
|
||||
// 获取电梯⇄楼层关联信息
|
||||
List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByAuthGroupId(authRecord.getGroupId());
|
||||
// 获取楼层数组
|
||||
List<Long> layerArray = floorInfo.stream().map(RemoteFloorVo::getId).sorted().toList();
|
||||
|
||||
layerArray.forEach(layer -> {
|
||||
SisElevatorFloorRefVo floorRef = floorRefList.stream()
|
||||
.filter(vo -> Objects.equals(vo.getFloorId(), layer)) // 直接使用 layer
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (floorRef == null) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 3);
|
||||
} else {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 2);
|
||||
}
|
||||
});
|
||||
|
||||
// todo 做延时队列,关闭梯控授权
|
||||
// 提交任务到线程池
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
// 5秒后清除权限
|
||||
Thread.sleep(5000L);
|
||||
for (int i = 0; i < layerArray.size(); i++) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), (i + 1), 3);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 关闭线程池
|
||||
executor.shutdown();
|
||||
}
|
||||
log.info("权限下发执行完成,耗时:{}", System.currentTimeMillis() - s);
|
||||
log.info("海康设备告警信息上传,设备={}, 人脸图片大小={}, 背景图片大小={}", sAlarmInfo, smallImg.length, bigImg.length);
|
||||
zeroSensationPassageService.pass(sAlarmInfo, smallImg, bigImg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,68 @@
|
||||
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.bo.SisAlarmEventAttachmentsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface ISisAlarmEventAttachmentsService {
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
SisAlarmEventAttachmentsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 【请填写功能名称】分页列表
|
||||
*/
|
||||
TableDataInfo<SisAlarmEventAttachmentsVo> queryPageList(SisAlarmEventAttachmentsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的【请填写功能名称】列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 【请填写功能名称】列表
|
||||
*/
|
||||
List<SisAlarmEventAttachmentsVo> queryList(SisAlarmEventAttachmentsBo bo);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param bo 【请填写功能名称】
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisAlarmEventAttachmentsBo bo);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param bo 【请填写功能名称】
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisAlarmEventAttachmentsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除【请填写功能名称】信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
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.bo.SisAlarmEventsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 告警Service接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface ISisAlarmEventsService {
|
||||
|
||||
/**
|
||||
* 查询告警
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 告警
|
||||
*/
|
||||
SisAlarmEventsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询告警列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 告警分页列表
|
||||
*/
|
||||
TableDataInfo<SisAlarmEventsVo> queryPageList(SisAlarmEventsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的告警列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 告警列表
|
||||
*/
|
||||
List<SisAlarmEventsVo> queryList(SisAlarmEventsBo bo);
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*
|
||||
* @param bo 告警
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisAlarmEventsBo bo);
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*
|
||||
* @param bo 告警
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisAlarmEventsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除告警信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 异步生成告警记录
|
||||
*/
|
||||
void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg);
|
||||
|
||||
}
|
@@ -71,10 +71,10 @@ public interface ISisDeviceManageService {
|
||||
/**
|
||||
* 通过设备ip查询设备信息
|
||||
*
|
||||
* @param deviceCode 设备编码
|
||||
* @param deviceIp 设备编码
|
||||
* @return 设备信息
|
||||
*/
|
||||
SisDeviceManageVo queryVoByDeviceIp(Integer deviceCode);
|
||||
SisDeviceManageVo queryVoByDeviceIp(String deviceIp);
|
||||
|
||||
/**
|
||||
* 查询设备数
|
||||
|
@@ -0,0 +1,78 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorChannelRefBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Service接口
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
public interface ISisElevatorFloorChannelRefService {
|
||||
|
||||
/**
|
||||
* 查询电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 电梯⇄楼层⇄通道关联
|
||||
*/
|
||||
SisElevatorFloorChannelRefVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 电梯⇄楼层⇄通道关联分页列表
|
||||
*/
|
||||
TableDataInfo<SisElevatorFloorChannelRefVo> queryPageList(SisElevatorFloorChannelRefBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 电梯⇄楼层⇄通道关联列表
|
||||
*/
|
||||
List<SisElevatorFloorChannelRefVo> queryList(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 新增电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 修改电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量增加电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
Boolean batchInsert(Long elevatorId, Collection<SisElevatorFloorChannelRef> bo);
|
||||
}
|
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* 电梯基本信息Service接口
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-07-10
|
||||
* @since 2025-07-10
|
||||
*/
|
||||
public interface ISisElevatorInfoService {
|
||||
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
public interface IZeroSensationPassageService {
|
||||
|
||||
/**
|
||||
* 无感通行服务
|
||||
*
|
||||
* @param deviceIp 设备ip
|
||||
* @param smallImp 人脸小图
|
||||
* @param bigImg 背景图片
|
||||
*/
|
||||
void pass(String deviceIp, byte[] smallImp, byte[] bigImg);
|
||||
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
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.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventAttachmentsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
import org.dromara.sis.mapper.SisAlarmEventAttachmentsMapper;
|
||||
import org.dromara.sis.service.ISisAlarmEventAttachmentsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttachmentsService {
|
||||
|
||||
private final SisAlarmEventAttachmentsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public SisAlarmEventAttachmentsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 【请填写功能名称】分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisAlarmEventAttachmentsVo> queryPageList(SisAlarmEventAttachmentsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = buildQueryWrapper(bo);
|
||||
Page<SisAlarmEventAttachmentsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的【请填写功能名称】列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 【请填写功能名称】列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisAlarmEventAttachmentsVo> queryList(SisAlarmEventAttachmentsBo bo) {
|
||||
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisAlarmEventAttachments> buildQueryWrapper(SisAlarmEventAttachmentsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAlarmEventAttachments::getId);
|
||||
lqw.eq(bo.getEventId() != null, SisAlarmEventAttachments::getEventId, bo.getEventId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOssId()), SisAlarmEventAttachments::getOssId, bo.getOssId());
|
||||
lqw.eq(bo.getType() != null, SisAlarmEventAttachments::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param bo 【请填写功能名称】
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisAlarmEventAttachmentsBo bo) {
|
||||
SisAlarmEventAttachments add = MapstructUtils.convert(bo, SisAlarmEventAttachments.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param bo 【请填写功能名称】
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisAlarmEventAttachmentsBo bo) {
|
||||
SisAlarmEventAttachments update = MapstructUtils.convert(bo, SisAlarmEventAttachments.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisAlarmEventAttachments entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除【请填写功能名称】信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,164 @@
|
||||
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.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.dromara.sis.domain.SisAlarmEvents;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.mapper.SisAlarmEventsMapper;
|
||||
import org.dromara.sis.service.ISisAlarmEventsService;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 告警Service业务层处理
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
|
||||
private final SisAlarmEventsMapper baseMapper;
|
||||
private final ISisDeviceManageService deviceManageService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 查询告警
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 告警
|
||||
*/
|
||||
@Override
|
||||
public SisAlarmEventsVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询告警列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 告警分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisAlarmEventsVo> queryPageList(SisAlarmEventsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisAlarmEvents> lqw = buildQueryWrapper(bo);
|
||||
Page<SisAlarmEventsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的告警列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 告警列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisAlarmEventsVo> queryList(SisAlarmEventsBo bo) {
|
||||
LambdaQueryWrapper<SisAlarmEvents> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisAlarmEvents> buildQueryWrapper(SisAlarmEventsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisAlarmEvents> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAlarmEvents::getId);
|
||||
lqw.eq(bo.getType() != null, SisAlarmEvents::getType, bo.getType());
|
||||
lqw.eq(bo.getLevel() != null, SisAlarmEvents::getLevel, bo.getLevel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceIp()), SisAlarmEvents::getDeviceIp, bo.getDeviceIp());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), SisAlarmEvents::getDeviceName, bo.getDeviceName());
|
||||
lqw.eq(bo.getDeviceGroupId() != null, SisAlarmEvents::getDeviceGroupId, bo.getDeviceGroupId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceGroupName()), SisAlarmEvents::getDeviceGroupName, bo.getDeviceGroupName());
|
||||
lqw.eq(bo.getReportTime() != null, SisAlarmEvents::getReportTime, bo.getReportTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*
|
||||
* @param bo 告警
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisAlarmEventsBo bo) {
|
||||
SisAlarmEvents add = MapstructUtils.convert(bo, SisAlarmEvents.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*
|
||||
* @param bo 告警
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisAlarmEventsBo bo) {
|
||||
SisAlarmEvents update = MapstructUtils.convert(bo, SisAlarmEvents.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisAlarmEvents entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除告警信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
// 校验设备信息
|
||||
SisDeviceManageVo sisDeviceManageVo = deviceManageService.queryVoByDeviceIp(deviceIp);
|
||||
if (sisDeviceManageVo == null) {
|
||||
log.error("设备信息不存在,放弃此条告警记录。");
|
||||
return;
|
||||
}
|
||||
// 上传图片
|
||||
RemoteFile small = remoteFileService.uploadImg(smallImg);
|
||||
RemoteFile big = remoteFileService.uploadImg(bigImg);
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -135,7 +135,7 @@ public class SisAuthGroupRefServiceImpl implements ISisAuthGroupRefService {
|
||||
|
||||
log.info("开始写入授权组电梯楼层,floorIds:{}", floorIds);
|
||||
// 获取该电梯所在单元的楼层信息
|
||||
List<RemoteFloorVo> floorVoList = remoteFloorService.queryByUnitId(ele.getUnitId());
|
||||
List<RemoteFloorVo> floorVoList = remoteFloorService.queryByBuildingId(ele.getBuildingId());
|
||||
// 该单元所有楼层id
|
||||
List<Long> allFloors = floorVoList.stream().map(RemoteFloorVo::getId).toList();
|
||||
// 对比找出授权楼层id
|
||||
|
@@ -289,7 +289,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
// 楼层节点
|
||||
List<TreeNode<Long>> floorTree = new ArrayList<>();
|
||||
// 获取楼层
|
||||
List<RemoteFloorVo> floorInfoList = remoteFloorService.queryByUnitId(item.getUnitId());
|
||||
List<RemoteFloorVo> floorInfoList = remoteFloorService.queryByBuildingId(item.getBuildingId());
|
||||
floorInfoList.forEach(floor -> {
|
||||
TreeNode<Long> floorNode = new TreeNode<>();
|
||||
floorNode.setLevel(3);
|
||||
|
@@ -175,9 +175,9 @@ public class SisDeviceManageServiceImpl implements ISisDeviceManageService {
|
||||
|
||||
|
||||
@Override
|
||||
public SisDeviceManageVo queryVoByDeviceIp(Integer deviceCode) {
|
||||
public SisDeviceManageVo queryVoByDeviceIp(String deviceIp) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceCode);
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceIp);
|
||||
return baseMapper.selectVoById(lqw);
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,157 @@
|
||||
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;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorChannelRefBo;
|
||||
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;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Service业务层处理
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisElevatorFloorChannelRefServiceImpl implements ISisElevatorFloorChannelRefService {
|
||||
|
||||
private final SisElevatorFloorChannelRefMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 电梯⇄楼层⇄通道关联
|
||||
*/
|
||||
@Override
|
||||
public SisElevatorFloorChannelRefVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 电梯⇄楼层⇄通道关联分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisElevatorFloorChannelRefVo> queryPageList(SisElevatorFloorChannelRefBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = buildQueryWrapper(bo);
|
||||
Page<SisElevatorFloorChannelRefVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 电梯⇄楼层⇄通道关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisElevatorFloorChannelRefVo> queryList(SisElevatorFloorChannelRefBo bo) {
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisElevatorFloorChannelRef> buildQueryWrapper(SisElevatorFloorChannelRefBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisElevatorFloorChannelRef::getId);
|
||||
lqw.eq(bo.getFloorId() != null, SisElevatorFloorChannelRef::getFloorId, bo.getFloorId());
|
||||
lqw.eq(bo.getElevatorId() != null, SisElevatorFloorChannelRef::getElevatorId, bo.getElevatorId());
|
||||
lqw.eq(bo.getInChannel() != null, SisElevatorFloorChannelRef::getInChannel, bo.getInChannel());
|
||||
lqw.eq(bo.getOutChannel() != null, SisElevatorFloorChannelRef::getOutChannel, bo.getOutChannel());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisElevatorFloorChannelRefBo bo) {
|
||||
SisElevatorFloorChannelRef add = MapstructUtils.convert(bo, SisElevatorFloorChannelRef.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisElevatorFloorChannelRefBo bo) {
|
||||
SisElevatorFloorChannelRef update = MapstructUtils.convert(bo, SisElevatorFloorChannelRef.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisElevatorFloorChannelRef entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean 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;
|
||||
}
|
||||
}
|
@@ -13,15 +13,17 @@ import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.api.RemoteUnitService;
|
||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
||||
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;
|
||||
@@ -34,7 +36,7 @@ import static org.dromara.common.core.constant.CodePrefixConstants.ELEVATOR_CONT
|
||||
* 电梯基本信息Service业务层处理
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-07-10
|
||||
* @since 2025-07-10
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -43,9 +45,10 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
|
||||
private final SisElevatorInfoMapper baseMapper;
|
||||
private final ISisDeviceBindRefService deviceBindRefService;
|
||||
private final ISisElevatorFloorChannelRefService elevatorFloorChannelRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteUnitService remoteUnitService;
|
||||
private RemoteBuildingService remoteBuildingService;
|
||||
|
||||
/**
|
||||
* 查询电梯基本信息
|
||||
@@ -57,20 +60,21 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
public SisElevatorInfoVo queryById(Long elevatorId) {
|
||||
SisElevatorInfoVo sisElevatorInfoVo = baseMapper.selectVoById(elevatorId);
|
||||
if (sisElevatorInfoVo == null) {
|
||||
return sisElevatorInfoVo;
|
||||
return null;
|
||||
}
|
||||
List<SisDeviceBindRef> ref = deviceBindRefService.queryByBindId(elevatorId);
|
||||
if (CollUtil.isNotEmpty(ref)) {
|
||||
List<Long> remoteCallElevatorDeviceId = new ArrayList<>(ref.size());
|
||||
Long elevatorControlDeviceId = null;
|
||||
List<SisElevatorInfoVo.DeviceInfo> remoteCallElevatorDeviceId = new ArrayList<>(ref.size());
|
||||
for (SisDeviceBindRef item : ref) {
|
||||
SisElevatorInfoVo.DeviceInfo deviceInfo = new SisElevatorInfoVo.DeviceInfo();
|
||||
deviceInfo.setDeviceId(item.getDeviceId());
|
||||
deviceInfo.setDeviceIp(item.getDeviceIp());
|
||||
if (Objects.equals(item.getControlType(), ControlTypeEnum.REMOTE_CALL_ELEVATOR.getCode())) {
|
||||
remoteCallElevatorDeviceId.add(item.getDeviceId());
|
||||
remoteCallElevatorDeviceId.add(deviceInfo);
|
||||
}else {
|
||||
elevatorControlDeviceId = item.getDeviceId();
|
||||
sisElevatorInfoVo.setElevatorControlDeviceId(deviceInfo);
|
||||
}
|
||||
sisElevatorInfoVo.setRemoteCallElevatorDeviceId(remoteCallElevatorDeviceId);
|
||||
sisElevatorInfoVo.setElevatorControlDeviceId(elevatorControlDeviceId);
|
||||
}
|
||||
}
|
||||
return sisElevatorInfoVo;
|
||||
@@ -136,17 +140,23 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SisElevatorInfoBo bo) {
|
||||
// 验证单元是否存在
|
||||
RemoteUnitVo remoteUnitVo = remoteUnitService.queryUnitById(bo.getUnitId());
|
||||
Assert.notNull(remoteUnitVo, "社区单元信息不存在。");
|
||||
// 验证建筑是否存在
|
||||
RemoteBuildingVo remoteBuildingVo = remoteBuildingService.queryBuildingById(bo.getBuildingId());
|
||||
Assert.notNull(remoteBuildingVo, "建筑信息不存在。");
|
||||
|
||||
// 数据转换
|
||||
SisElevatorInfo add = MapstructUtils.convert(bo, SisElevatorInfo.class);
|
||||
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();
|
||||
add.setElevatorCode(code);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增电梯信息失败。");
|
||||
|
||||
if (flag) {
|
||||
bo.setElevatorId(add.getElevatorId());
|
||||
List<SisDeviceBindRef> ls = new ArrayList<>();
|
||||
@@ -175,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());
|
||||
@@ -223,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;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,154 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
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.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.RemoteOpenDoorReq;
|
||||
import org.dromara.sis.sdk.huawei.HuaWeiBoxApi;
|
||||
import org.dromara.sis.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 无感通行业务服务实现
|
||||
*
|
||||
* @author lxj, lsm
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageService {
|
||||
|
||||
private final HuaWeiBoxApi huaWeiBoxApi;
|
||||
private final ISisAuthRecordService authRecordService;
|
||||
private final ISisElevatorInfoService elevatorInfoService;
|
||||
private final ISisAuthGroupRefService authGroupRefService;
|
||||
private final ISisDeviceBindRefService deviceBindRefService;
|
||||
private final ISisAccessControlService accessControlService;
|
||||
private final ISisElevatorFloorRefService elevatorFloorRefService;
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
private final ISisAlarmEventsService alarmEventsService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
|
||||
@Override
|
||||
public void pass(String deviceIp, byte[] smallImg, byte[] bigImg) {
|
||||
TimeInterval interval = new TimeInterval();
|
||||
// 抓拍小图
|
||||
String smallImgBase64Str = Base64Encoder.encode(smallImg);
|
||||
Long person = huaWeiBoxApi.findPerson(smallImgBase64Str);
|
||||
log.info("人脸比对执行完成,耗时:{}ms", interval);
|
||||
if (person == null) {
|
||||
log.info("未命中人脸数据,暂不处理。");
|
||||
return;
|
||||
}
|
||||
// 验证当前人原是否存在授权记录
|
||||
SisAuthRecordVo authRecord = authRecordService.checkAuth(person);
|
||||
log.info("查询人员权限记录完成,耗时={}ms", interval.interval());
|
||||
if (authRecord == null) {
|
||||
// todo 产生高危告警记录
|
||||
log.info("当前人脸未授权,暂不处理。");
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
if (DateUtil.compare(now, authRecord.getEndDate()) > 0) {
|
||||
// todo 生成一般告警记录
|
||||
log.info("当前人脸已过期,暂不处理。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取当前设备的绑定设备信息
|
||||
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(deviceIp);
|
||||
log.info("查询设备绑定的梯控/门禁完成,耗时={}ms", interval.interval());
|
||||
if (CollUtil.isEmpty(bindRefList)) {
|
||||
log.info("当前报警设备未绑定门禁/梯控,不做处理!");
|
||||
return;
|
||||
}
|
||||
// 授权设备列表
|
||||
List<SisAuthGroupRefVo> authGroupRefVos = authGroupRefService.queryListByGroupId(authRecord.getGroupId());
|
||||
// 验证当前设备的绑定门禁和梯控是否有使用权限
|
||||
bindRefList.forEach(item -> {
|
||||
SisAuthGroupRefVo r = null;
|
||||
for (SisAuthGroupRefVo ref : authGroupRefVos) {
|
||||
if (Objects.equals(item.getBindId(), ref.getDeviceId())) {
|
||||
r = ref;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (r == null) {
|
||||
log.info("人员[{}]不存在门禁/电梯[{}]的通行权限", person, item.getBindId());
|
||||
return;
|
||||
}
|
||||
// 判断绑定设备类型,走不同的处理方法
|
||||
if (item.getControlType() == 1) { // 门禁
|
||||
handleAc(item.getDeviceId());
|
||||
} else if (item.getControlType() == 2) { // 电梯外面面板权限
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 2);
|
||||
} else if (item.getControlType() == 3) { // 电梯里面的面板
|
||||
handleEle(item.getDeviceId(), r.getAuthGroupId(), 3);
|
||||
} else {
|
||||
log.info("设备绑定了未知的控制类型[{}],不处理", item.getControlType());
|
||||
}
|
||||
});
|
||||
log.info("权限下发执行完成,耗时:{}ms", interval.interval());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成告警事件
|
||||
*/
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
alarmEventsService.createAlarmRecord(deviceIp, level, type, smallImg, bigImg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理门禁
|
||||
*/
|
||||
public void handleAc(Long deviceId) {
|
||||
if (deviceId != null) {
|
||||
SisAccessControlVo ac = accessControlService.queryById(deviceId);
|
||||
log.info("调用门禁服务远程开门,doorName:{}", ac.getAccessName());
|
||||
RemoteOpenDoorReq req = new RemoteOpenDoorReq();
|
||||
req.setType(0);
|
||||
RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
|
||||
data.setDeviceId(Long.parseLong(ac.getOutCode()));
|
||||
data.setDoorId(Long.parseLong(ac.getOutCode()));
|
||||
req.setControlList(List.of(data));
|
||||
Boolean flag = e8PlatformApi.remoteOpenDoor(req);
|
||||
log.info("远程开门结果,result={}", flag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证电梯权限
|
||||
*/
|
||||
public void handleEle(Long deviceId, Long groupId, Integer controlType) {
|
||||
log.info("开始下发梯控权限....");
|
||||
// 获取电梯信息
|
||||
// 获取电梯信息
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -35,7 +35,7 @@ public class SyncLiftAuthTask {
|
||||
/**
|
||||
* 同步电梯权限
|
||||
*/
|
||||
@Scheduled(cron = "*/5 * 6-22 * * ?")
|
||||
// @Scheduled(cron = "*/5 * 6-22 * * ?")
|
||||
public void syncLiftAuth() {
|
||||
QueryDto dto = new QueryDto();
|
||||
dto.setPageIndex(1);
|
||||
|
@@ -0,0 +1,7 @@
|
||||
<?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.SisAlarmEventAttachmentsMapper">
|
||||
|
||||
</mapper>
|
@@ -0,0 +1,7 @@
|
||||
<?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.SisAlarmEventsMapper">
|
||||
|
||||
</mapper>
|
@@ -5,7 +5,9 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.enums.ContentTypeEnum;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.Base64Utils;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.oss.core.OssClient;
|
||||
@@ -66,6 +68,36 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteFile uploadImg(byte[] file) throws ServiceException {
|
||||
try {
|
||||
// 计算文件类型
|
||||
String type = Base64Utils.getType(file);
|
||||
// 获contentType
|
||||
ContentTypeEnum contentTypeEnum = ContentTypeEnum.ContentTypeEnum(type);
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult = storage.uploadSuffix(file, type, contentTypeEnum.getContentType());
|
||||
// 保存文件信息
|
||||
SysOssBo oss = new SysOssBo();
|
||||
oss.setUrl(uploadResult.getUrl());
|
||||
oss.setFileSuffix(type);
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(uploadResult.getFilename());
|
||||
oss.setService(storage.getConfigKey());
|
||||
sysOssService.insertByBo(oss);
|
||||
RemoteFile sysFile = new RemoteFile();
|
||||
sysFile.setOssId(oss.getOssId());
|
||||
sysFile.setName(uploadResult.getFilename());
|
||||
sysFile.setUrl(uploadResult.getUrl());
|
||||
sysFile.setOriginalName(uploadResult.getFilename());
|
||||
sysFile.setFileSuffix(type);
|
||||
return sysFile;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
throw new ServiceException("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ossId查询对应的url
|
||||
*
|
||||
|
Reference in New Issue
Block a user