Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 12m45s
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 12m45s
This commit is contained in:
@@ -4,11 +4,13 @@ import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.QueryDto;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.AccessRecordFindReq;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.res.AccessRecordFindRes;
|
||||
import org.dromara.sis.sdk.e8.domain.door.res.AuthDoorDeviceFindRes;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -16,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyongle
|
||||
@@ -25,14 +30,16 @@ import java.util.Date;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/visitor")
|
||||
public class SisVisitorController {
|
||||
@RequestMapping("/e8")
|
||||
public class E8Controller {
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
|
||||
/**
|
||||
* 查询人员通行记录
|
||||
*
|
||||
* @return tableDataInfo
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@GetMapping("/visitor/list")
|
||||
public TableDataInfo<AccessRecordFindRes> list(@RequestParam(required = false) String begTime,
|
||||
@RequestParam(required = false) String endTime,
|
||||
@NotNull(message = "页码不能为空") @RequestParam Integer pageNum,
|
||||
@@ -67,4 +74,18 @@ public class SisVisitorController {
|
||||
dto.setMaxResultCount(pageSize);
|
||||
return e8PlatformApi.getPageAccessRecordList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门禁设备在线情况
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
@GetMapping("/door/online")
|
||||
public R<Map<String, Long>> doorOnline() {
|
||||
List<AuthDoorDeviceFindRes> list = e8PlatformApi.getPageAuthDoorDeviceList();
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("on", list.stream().filter(o -> o.getOnlineStatus() == 1).count());
|
||||
map.put("off", list.stream().filter(o -> o.getOnlineStatus() == 0).count());
|
||||
return R.ok(map);
|
||||
}
|
||||
}
|
@@ -23,7 +23,9 @@ import org.dromara.sis.service.ISisDeviceManageService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备管理
|
||||
@@ -114,5 +116,17 @@ public class SisDeviceManageController extends BaseController {
|
||||
return R.ok(sisDeviceManageService.tree());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计设备在线状态
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
@GetMapping("/online")
|
||||
public R<Map<String, Long>> getOnlineStatus() {
|
||||
List<SisDeviceManageVo> list = sisDeviceManageService.queryList(new SisDeviceManageBo());
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("on", list.stream().filter(o -> o.getDeviceStatus() == 1).count());
|
||||
map.put("off", list.stream().filter(o -> o.getDeviceStatus() == 0).count());
|
||||
return R.ok(map);
|
||||
}
|
||||
}
|
||||
|
@@ -61,6 +61,11 @@ public class SisDeviceManageVo implements Serializable {
|
||||
*/
|
||||
private Integer deviceType;
|
||||
|
||||
/**
|
||||
* 设备在线状态 0:离线 1:在线 2:未知
|
||||
*/
|
||||
private Integer deviceStatus;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
|
@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.sis.api.RemoteVisitorService;
|
||||
import org.dromara.sis.api.domain.RemoteVisitor;
|
||||
@@ -15,7 +16,6 @@ import org.dromara.sis.sdk.e8.domain.visitors.req.VisitorAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.res.VisitorAddRes;
|
||||
import org.dromara.sis.sdk.e8.utils.ImageUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,14 +44,16 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
@Override
|
||||
public Map<String, Object> syncE8PlatVisitor(RemoteVisitor visitor) {
|
||||
try {
|
||||
byte[] imgByte = fileService.downloadToByteArray(Long.parseLong(visitor.getVisitorFaceImg()));
|
||||
Assert.notNull(imgByte, "下载访客照片失败");
|
||||
String imgUrl = null;
|
||||
if (StringUtils.isNotBlank(visitor.getVisitorFaceImg())) {
|
||||
byte[] imgByte = fileService.downloadToByteArray(Long.parseLong(visitor.getVisitorFaceImg()));
|
||||
Assert.notNull(imgByte, "下载访客照片失败");
|
||||
|
||||
byte[] zipByte = imageUtil.compressImageToRequirements(imgByte);
|
||||
|
||||
String imgUrl = e8PlatformApi.uploadFace(zipByte);
|
||||
Assert.notNull(imgUrl, "e8平台上传访客照片失败");
|
||||
byte[] zipByte = imageUtil.compressImageToRequirements(imgByte);
|
||||
|
||||
imgUrl = e8PlatformApi.uploadFace(zipByte);
|
||||
Assert.notNull(imgUrl, "e8平台上传访客照片失败");
|
||||
}
|
||||
VisitorAddReq req = new VisitorAddReq();
|
||||
req.setVisitorName(visitor.getVisitorName());
|
||||
req.setMobilePhone(visitor.getMobilePhone());
|
||||
@@ -68,7 +70,7 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
: Map.of("code", 500, "data", res.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
return Map.of("code", 500, "data", "e8平台新增访客登记出错");
|
||||
return Map.of("code", 500, "data", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +92,7 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
return Map.of("code", 500, "data", "e8平台获取访客二维码出错");
|
||||
return Map.of("code", 500, "data", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,4 +29,9 @@ public class AuthDoorDeviceFindRes {
|
||||
* 门禁Id
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 门禁状态
|
||||
*/
|
||||
private Integer onlineStatus;
|
||||
}
|
||||
|
Reference in New Issue
Block a user