[add] 新增萤石摄像头图片定时清理 [update] 修改大屏位置数据返回逻辑
This commit is contained in:
@ -103,11 +103,11 @@ spring.data:
|
||||
# 地址
|
||||
host: 192.168.110.2
|
||||
# 端口,默认为6379
|
||||
port: 63079
|
||||
port: 9287
|
||||
# 数据库索引
|
||||
database: 5
|
||||
# redis 密码必须配置
|
||||
password: HMASKEbyhaASPZXB
|
||||
password: syar23rdsaagdrsa
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
@ -275,5 +275,5 @@ weather:
|
||||
dxf2GeoJson:
|
||||
file-name: main
|
||||
ys7:
|
||||
app-key: xx
|
||||
app-secret: xx
|
||||
app-key: 3acf9f1a43dc4209841e0893003db0a2
|
||||
app-secret: 4bbf3e9394f55d3af6e3af27b2d3db36
|
||||
|
@ -16,8 +16,8 @@ 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.facility.domain.dto.matrix.*;
|
||||
import org.dromara.facility.domain.vo.matrix.FacFacilityPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixDetailGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixVo;
|
||||
import org.dromara.facility.service.IFacMatrixService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -84,10 +84,9 @@ public class FacMatrixController extends BaseController {
|
||||
* 获取设施-方阵大屏位置详情
|
||||
*/
|
||||
@SaCheckPermission("facility:matrix:query")
|
||||
@GetMapping("/gis/position/{id}")
|
||||
public R<FacMatrixPositionGisVo> getPositionGis(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(facMatrixService.getPositionGis(id));
|
||||
@GetMapping("/gis/position")
|
||||
public R<List<FacFacilityPositionGisVo>> getPositionGis(FacFacilityPositionGisReq req) {
|
||||
return R.ok(facMatrixService.getPositionGis(req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,30 @@
|
||||
package org.dromara.facility.domain.dto.matrix;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/6/19 11:58
|
||||
*/
|
||||
@Data
|
||||
public class FacFacilityPositionGisReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7826656662352650068L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目ID不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 方阵id列表
|
||||
*/
|
||||
private List<Long> matrixIdList;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.dromara.facility.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/6/19 9:37
|
||||
*/
|
||||
@Getter
|
||||
public enum FacCategoryEnum {
|
||||
|
||||
MATRIX("方阵", "fz"),
|
||||
PHOTOVOLTAIC_PANEL("光伏板", "gfb"),
|
||||
BOX_TRANSFORMER("箱变", "xb"),
|
||||
INVERTER("逆变器", "nbq"),
|
||||
PHOTOVOLTAIC_PANEL_SUPPORT("光伏板支架", "gfbzj"),
|
||||
PHOTOVOLTAIC_PANEL_COLUMN("光伏板立柱", "gfblz"),
|
||||
PHOTOVOLTAIC_PANEL_POINT("光伏板桩点", "gfbzd");
|
||||
|
||||
private final String text;
|
||||
|
||||
private final String value;
|
||||
|
||||
FacCategoryEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// 根据 value 获取对应的 text
|
||||
public static String getTextByValue(String value) {
|
||||
for (FacCategoryEnum type : values()) {
|
||||
if (Objects.equals(type.getValue(), value)) {
|
||||
return type.getText();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.dromara.facility.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/6/19 9:26
|
||||
*/
|
||||
@Getter
|
||||
public enum FacCoordinateTypeEnum {
|
||||
|
||||
POINT("Point", 1),
|
||||
POLYGON("Polygon", 2);
|
||||
|
||||
private final String text;
|
||||
|
||||
private final int value;
|
||||
|
||||
FacCoordinateTypeEnum(String text, int value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// 根据 value 获取对应的 text
|
||||
public static String getTextByValue(int value) {
|
||||
for (FacCoordinateTypeEnum type : values()) {
|
||||
if (type.getValue() == value) {
|
||||
return type.getText();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package org.dromara.facility.domain.vo.matrix;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import org.dromara.facility.domain.enums.FacCoordinateTypeEnum;
|
||||
import org.dromara.utils.JsonDimensionUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/6/19 9:20
|
||||
*/
|
||||
@Data
|
||||
public class FacFacilityPositionGisVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7684151080297158036L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private JSONArray positionList;
|
||||
|
||||
/**
|
||||
* 完成状态(0未开始 1进行中 2完成)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 坐标类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 对象转vo
|
||||
*
|
||||
* @param id 主键
|
||||
* @param name 名称
|
||||
* @param positions 位置字符串
|
||||
* @param status 完成状态(0未开始 1进行中 2完成)
|
||||
* @return FacFacilityPositionGisVo
|
||||
*/
|
||||
public static FacFacilityPositionGisVo obj2vo(Long id, String name, String positions, String status, String category) {
|
||||
FacFacilityPositionGisVo vo = new FacFacilityPositionGisVo();
|
||||
vo.setId(id);
|
||||
vo.setName(name);
|
||||
JSONArray positionList = JSONUtil.parseArray(positions);
|
||||
vo.setPositionList(positionList);
|
||||
vo.setStatus(status);
|
||||
int depth = JsonDimensionUtil.getJsonArrayDepth(positionList);
|
||||
vo.setType(FacCoordinateTypeEnum.getTextByValue(depth));
|
||||
vo.setCategory(category);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
@ -7,8 +7,8 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.facility.domain.FacMatrix;
|
||||
import org.dromara.facility.domain.dto.matrix.*;
|
||||
import org.dromara.facility.domain.vo.matrix.FacFacilityPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixDetailGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -133,9 +133,9 @@ public interface IFacMatrixService extends IService<FacMatrix> {
|
||||
/**
|
||||
* 获取设施-方阵位置信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @param req 主键
|
||||
* @return 设施-方阵位置信息
|
||||
*/
|
||||
FacMatrixPositionGisVo getPositionGis(Long id);
|
||||
List<FacFacilityPositionGisVo> getPositionGis(FacFacilityPositionGisReq req);
|
||||
|
||||
}
|
||||
|
@ -17,19 +17,15 @@ import org.dromara.facility.constant.FacRedisKeyConstant;
|
||||
import org.dromara.facility.domain.*;
|
||||
import org.dromara.facility.domain.dto.geojson.*;
|
||||
import org.dromara.facility.domain.dto.matrix.*;
|
||||
import org.dromara.facility.domain.enums.FacCategoryEnum;
|
||||
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
|
||||
import org.dromara.facility.domain.vo.boxtransformer.FacBoxTransformerPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.inverter.FacInverterPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacFacilityPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixDetailGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixVo;
|
||||
import org.dromara.facility.domain.vo.photovoltaicpanel.FacPhotovoltaicPanelPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointPositionGisVo;
|
||||
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportPositionGisVo;
|
||||
import org.dromara.facility.mapper.FacMatrixMapper;
|
||||
import org.dromara.facility.service.*;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -563,17 +559,35 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
/**
|
||||
* 获取设施-方阵位置信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @param req 主键
|
||||
* @return 设施-方阵位置信息
|
||||
*/
|
||||
@Override
|
||||
public FacMatrixPositionGisVo getPositionGis(Long id) {
|
||||
FacMatrix matrix = this.getById(id);
|
||||
if (matrix == null) {
|
||||
throw new ServiceException("查询方阵失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
public List<FacFacilityPositionGisVo> getPositionGis(FacFacilityPositionGisReq req) {
|
||||
Long projectId = req.getProjectId();
|
||||
List<Long> matrixIdList = req.getMatrixIdList();
|
||||
BusProject project = projectService.getById(projectId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("项目信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long projectId = matrix.getProjectId();
|
||||
FacMatrixPositionGisVo matrixPositionGisVo = new FacMatrixPositionGisVo();
|
||||
List<FacFacilityPositionGisVo> result = new ArrayList<>();
|
||||
List<FacMatrix> matrixList = this.lambdaQuery()
|
||||
.eq(FacMatrix::getProjectId, projectId)
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacMatrix::getId, matrixIdList)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(matrixList)) {
|
||||
return result;
|
||||
}
|
||||
List<FacFacilityPositionGisVo> matrixVoList = matrixList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getMatrixName(),
|
||||
obj.getPositions(),
|
||||
null,
|
||||
FacCategoryEnum.MATRIX.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(matrixVoList);
|
||||
// 获取光伏板立柱信息
|
||||
List<FacPhotovoltaicPanelColumn> columnList = photovoltaicPanelColumnService.lambdaQuery()
|
||||
.select(
|
||||
@ -583,10 +597,18 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
FacPhotovoltaicPanelColumn::getStatus
|
||||
)
|
||||
.eq(FacPhotovoltaicPanelColumn::getProjectId, projectId)
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanelColumn::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacPhotovoltaicPanelColumnPositionGisVo> columnVoList = columnList
|
||||
.stream().map(FacPhotovoltaicPanelColumnPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setPhotovoltaicPanelColumnPositionList(columnVoList);
|
||||
List<FacFacilityPositionGisVo> columnVoList = columnList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.PHOTOVOLTAIC_PANEL_COLUMN.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(columnVoList);
|
||||
// 获取光伏板点信息
|
||||
List<FacPhotovoltaicPanelPoint> pointList = photovoltaicPanelPointService.lambdaQuery()
|
||||
.select(
|
||||
@ -596,10 +618,18 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
FacPhotovoltaicPanelPoint::getStatus
|
||||
)
|
||||
.eq(FacPhotovoltaicPanelPoint::getProjectId, projectId)
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanelPoint::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacPhotovoltaicPanelPointPositionGisVo> pointVoList = pointList
|
||||
.stream().map(FacPhotovoltaicPanelPointPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setPhotovoltaicPanelPointPositionList(pointVoList);
|
||||
List<FacFacilityPositionGisVo> pointVoList = pointList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.PHOTOVOLTAIC_PANEL_POINT.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(pointVoList);
|
||||
// 获取光伏板支架信息
|
||||
List<FacPhotovoltaicPanelSupport> supportList = photovoltaicPanelSupportService.lambdaQuery()
|
||||
.select(
|
||||
@ -609,10 +639,18 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
FacPhotovoltaicPanelSupport::getStatus
|
||||
)
|
||||
.eq(FacPhotovoltaicPanelSupport::getProjectId, projectId)
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanelSupport::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacPhotovoltaicPanelSupportPositionGisVo> supportVoList = supportList
|
||||
.stream().map(FacPhotovoltaicPanelSupportPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setPhotovoltaicPanelSupportPositionList(supportVoList);
|
||||
List<FacFacilityPositionGisVo> supporVotList = supportList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.PHOTOVOLTAIC_PANEL_SUPPORT.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(supporVotList);
|
||||
// 获取光伏板信息
|
||||
List<FacPhotovoltaicPanel> panelList = photovoltaicPanelService.lambdaQuery()
|
||||
.select(
|
||||
@ -623,10 +661,18 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
)
|
||||
.eq(FacPhotovoltaicPanel::getProjectId, projectId)
|
||||
.eq(FacPhotovoltaicPanel::getProgressCategoryName, "光伏板")
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacPhotovoltaicPanel::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacPhotovoltaicPanelPositionGisVo> panelVoList = panelList
|
||||
.stream().map(FacPhotovoltaicPanelPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setPhotovoltaicPanelPositionList(panelVoList);
|
||||
List<FacFacilityPositionGisVo> panelVoList = panelList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.PHOTOVOLTAIC_PANEL.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(panelVoList);
|
||||
// 获取箱变信息
|
||||
List<FacBoxTransformer> boxTransformerList = boxTransformerService.lambdaQuery()
|
||||
.select(
|
||||
@ -637,10 +683,18 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
)
|
||||
.eq(FacBoxTransformer::getProjectId, projectId)
|
||||
.eq(FacBoxTransformer::getProgressCategoryName, "箱变基础")
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacBoxTransformer::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacBoxTransformerPositionGisVo> boxTransformerVoList = boxTransformerList
|
||||
.stream().map(FacBoxTransformerPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setBoxTransformerPositionList(boxTransformerVoList);
|
||||
List<FacFacilityPositionGisVo> boxTransformerVoList = boxTransformerList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.BOX_TRANSFORMER.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(boxTransformerVoList);
|
||||
// 获取逆变器信息
|
||||
List<FacInverter> inverterList = inverterService.lambdaQuery()
|
||||
.select(
|
||||
@ -651,21 +705,19 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
)
|
||||
.eq(FacInverter::getProjectId, projectId)
|
||||
.eq(FacInverter::getProgressCategoryName, "逆变器安装")
|
||||
.in(CollUtil.isNotEmpty(matrixIdList), FacInverter::getMatrixId, matrixIdList)
|
||||
.list();
|
||||
List<FacInverterPositionGisVo> inverterVoList = inverterList
|
||||
.stream().map(FacInverterPositionGisVo::obj2vo).toList();
|
||||
matrixPositionGisVo.setInverterPositionList(inverterVoList);
|
||||
// 封装方阵信息
|
||||
matrixPositionGisVo.setMatrixName(matrix.getMatrixName());
|
||||
matrixPositionGisVo.setId(matrix.getId());
|
||||
String positions = matrix.getPositions();
|
||||
List<List<Double>> positionList = new ArrayList<>();
|
||||
List<String> arr = JSONUtil.toList(positions, String.class);
|
||||
for (String s : arr) {
|
||||
positionList.add(JSONUtil.toList(s, Double.class));
|
||||
}
|
||||
matrixPositionGisVo.setPositions(positionList);
|
||||
return matrixPositionGisVo;
|
||||
List<FacFacilityPositionGisVo> inverterVoList = inverterList.stream().map(obj ->
|
||||
FacFacilityPositionGisVo.obj2vo(
|
||||
obj.getId(),
|
||||
obj.getName(),
|
||||
obj.getPositions(),
|
||||
obj.getStatus(),
|
||||
FacCategoryEnum.INVERTER.getValue()
|
||||
))
|
||||
.toList();
|
||||
result.addAll(inverterVoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class IncSyncDeleteProjectCache {
|
||||
public class DeleteProjectCache {
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
@ -0,0 +1,37 @@
|
||||
package org.dromara.job.cycle;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/6/19 10:23
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DeleteYs7DeviceCapturePicData {
|
||||
|
||||
@Resource
|
||||
private IOthYs7DeviceImgService ys7DeviceImgService;
|
||||
|
||||
@Scheduled(cron = "0 0 4 * * ?")
|
||||
public void run() {
|
||||
log.info("执行定时任务:清理萤石设备抓拍图片数据");
|
||||
// 构建扫描选项
|
||||
Date thirtyDaysAgo = DateUtils.toDate(LocalDateTime.now().minusDays(30));
|
||||
int deleteCount = ys7DeviceImgService.deleteByCreateTimeBefore(thirtyDaysAgo);
|
||||
String formatDate = DateUtils.formatDateTime(thirtyDaysAgo);
|
||||
if (deleteCount > 0) {
|
||||
log.info("清理萤石设备抓拍图片数据完成,清理时间:{},删除了 {} 条数据", formatDate, deleteCount);
|
||||
} else {
|
||||
log.info("清理萤石设备抓拍图片数据完成,清理时间:{},没有数据需要清理", formatDate);
|
||||
}
|
||||
}
|
||||
}
|
@ -46,14 +46,14 @@ public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
// 每 5 分钟执行一次
|
||||
@Scheduled(cron = "0 */5 * * * ?")
|
||||
// 每 30 分钟执行一次
|
||||
@Scheduled(cron = "0 */30 7-19 * * ?")
|
||||
public void run() {
|
||||
// 查询所有在线的摄像头设备,仅获取必要字段
|
||||
List<OthYs7Device> deviceList = ys7DeviceService.lambdaQuery()
|
||||
.select(OthYs7Device::getId, OthYs7Device::getDeviceSerial, OthYs7Device::getDeviceName)
|
||||
.eq(OthYs7Device::getStatus, OthDeviceStatusEnum.ONLINE.getValue())
|
||||
.list().subList(0, 10);
|
||||
.list();
|
||||
// 提取设备序列号用于后续查询预置位
|
||||
List<String> deviceSerialList = deviceList.stream()
|
||||
.map(OthYs7Device::getDeviceSerial).toList();
|
||||
|
@ -45,7 +45,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7ResponseVo responseVo = JSONUtil.toBean(body, Ys7ResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
log.info("Ys7 Token 请求成功:{}", body);
|
||||
@ -85,7 +85,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7PageResponseVo responseVo = JSONUtil.toBean(body, Ys7PageResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
log.info("Ys7 分页查询设备列表 第{}页大小{} 响应数据:{}", pageStart, pageSize, responseVo.getData());
|
||||
@ -127,7 +127,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7NoDataResponseVo responseVo = JSONUtil.toBean(body, Ys7NoDataResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
log.info("修改设备名称请求成功,设备 {} 名称修改为 {}", deviceSerial, deviceName);
|
||||
@ -162,7 +162,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7ResponseVo responseVo = JSONUtil.toBean(body, Ys7ResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
// 获取 data 中的 index
|
||||
@ -204,7 +204,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7NoDataResponseVo responseVo = JSONUtil.toBean(body, Ys7NoDataResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
log.info("调用设备预置点请求成功,设备 {} 调用预置点成功,通道:{},序号 {}", deviceSerial, channelNo, index);
|
||||
@ -241,7 +241,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7NoDataResponseVo responseVo = JSONUtil.toBean(body, Ys7NoDataResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
log.info("删除设备预置点请求成功,设备 {} 删除预置点成功,通道:{},序号 {}", deviceSerial, channelNo, index);
|
||||
@ -281,7 +281,7 @@ public class Ys7RequestUtils {
|
||||
String body = response.body();
|
||||
Ys7ResponseVo responseVo = JSONUtil.toBean(body, Ys7ResponseVo.class);
|
||||
if (!responseVo.getCode().equals("200")) {
|
||||
log.error("{}:{}", errorMsg, responseVo.getMsg());
|
||||
log.error("{},状态码:{},:{}", errorMsg, responseVo.getCode(), responseVo.getMsg());
|
||||
throw new ServiceException(errorMsg + responseVo.getMsg());
|
||||
}
|
||||
String data = responseVo.getData();
|
||||
|
@ -56,6 +56,15 @@ public class OthYs7DeviceController extends BaseController {
|
||||
return othYs7DeviceService.queryPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目查询萤石摄像头列表
|
||||
*/
|
||||
@SaCheckPermission("other:ys7Device:list")
|
||||
@GetMapping("/list/project")
|
||||
public TableDataInfo<OthYs7DeviceVo> listByProject(Long projectId, PageQuery pageQuery) {
|
||||
return othYs7DeviceService.queryPageListByProject(projectId, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出萤石摄像头列表
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@ package org.dromara.other.controller;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
@ -65,4 +66,17 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
return R.ok(othYs7DeviceImgService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除萤石摄像头图片
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:remove")
|
||||
@Log(title = "萤石摄像头图片", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(othYs7DeviceImgService.deleteWithValidByIds(List.of(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package org.dromara.other.domain.dto.ys7deviceimg;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
@ -25,4 +28,11 @@ public class OthYs7DeviceImgQueryReq implements Serializable {
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.dromara.other.domain.OthYs7DeviceImg;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
@ -54,5 +55,10 @@ public class OthYs7DeviceImgVo implements Serializable {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCreateByCapture;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -75,4 +77,20 @@ public interface IOthYs7DeviceImgService extends IService<OthYs7DeviceImg> {
|
||||
* @param imgList 抓拍图片列表
|
||||
*/
|
||||
void saveCapturePic(List<OthYs7DeviceImgCreateByCapture> imgList);
|
||||
|
||||
/**
|
||||
* 根据创建时间删除图片
|
||||
*
|
||||
* @param cutoffDate 截止时间
|
||||
* @return 删除数量
|
||||
*/
|
||||
int deleteByCreateTimeBefore(Date cutoffDate);
|
||||
|
||||
/**
|
||||
* 校验并批量删除萤石摄像头图片信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids);
|
||||
}
|
||||
|
@ -38,6 +38,15 @@ public interface IOthYs7DeviceService extends IService<OthYs7Device> {
|
||||
*/
|
||||
TableDataInfo<OthYs7DeviceVo> queryPageList(OthYs7DeviceQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 分页查询萤石摄像头列表
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @param pageQuery 分页参数
|
||||
* @return 萤石摄像头分页列表
|
||||
*/
|
||||
TableDataInfo<OthYs7DeviceVo> queryPageListByProject(Long projectId, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的萤石摄像头列表
|
||||
*
|
||||
@ -133,4 +142,5 @@ public interface IOthYs7DeviceService extends IService<OthYs7Device> {
|
||||
* @param receiveMessage 接收消息
|
||||
*/
|
||||
void webhook(WebhookMessage receiveMessage);
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,12 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -109,8 +114,22 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
}
|
||||
String deviceSerial = req.getDeviceSerial();
|
||||
String deviceName = req.getDeviceName();
|
||||
Date createTime = req.getCreateTime();
|
||||
lqw.like(StringUtils.isNotBlank(deviceSerial), OthYs7DeviceImg::getDeviceSerial, deviceSerial);
|
||||
lqw.like(StringUtils.isNotBlank(deviceName), OthYs7DeviceImg::getDeviceName, deviceName);
|
||||
if (createTime != null) {
|
||||
// 构造当天的起始和结束时间
|
||||
LocalDate localDate = createTime.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
LocalDateTime startOfDay = localDate.atStartOfDay();
|
||||
LocalDateTime startOfNextDay = localDate.plusDays(1).atStartOfDay();
|
||||
Date start = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||
Date end = Date.from(startOfNextDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||
lqw.ge(OthYs7DeviceImg::getCreateTime, start)
|
||||
.lt(OthYs7DeviceImg::getCreateTime, end);
|
||||
}
|
||||
lqw.orderByDesc(OthYs7DeviceImg::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -168,6 +187,31 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据创建时间删除图片
|
||||
*
|
||||
* @param cutoffDate 截止时间
|
||||
* @return 删除数量
|
||||
*/
|
||||
@Override
|
||||
public int deleteByCreateTimeBefore(Date cutoffDate) {
|
||||
LambdaQueryWrapper<OthYs7DeviceImg> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.lt(OthYs7DeviceImg::getCreateTime, cutoffDate);
|
||||
return baseMapper.delete(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除萤石摄像头图片信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids) {
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取文件名
|
||||
*
|
||||
|
@ -82,6 +82,26 @@ public class OthYs7DeviceServiceImpl extends ServiceImpl<OthYs7DeviceMapper, Oth
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询萤石摄像头列表
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @param pageQuery 分页参数
|
||||
* @return 萤石摄像头分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OthYs7DeviceVo> queryPageListByProject(Long projectId, PageQuery pageQuery) {
|
||||
BusProject project = projectService.getById(projectId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("项目信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
LambdaQueryWrapper<OthYs7Device> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(OthYs7Device::getProjectId, projectId);
|
||||
lqw.orderByDesc(OthYs7Device::getStatus);
|
||||
Page<OthYs7Device> result = this.page(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的萤石摄像头列表
|
||||
*
|
||||
|
@ -1119,3 +1119,20 @@ CREATE TABLE `oth_ys7_device_img`
|
||||
primary key (`id`) using btree,
|
||||
index `idx_device_serial` (`device_serial` asc) using btree comment '设备序列号'
|
||||
) comment = '萤石摄像头图片' collate = utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `hse_violation_level`;
|
||||
CREATE TABLE `hse_violation_level`
|
||||
(
|
||||
`id` bigint not null auto_increment comment '主键id',
|
||||
`project_id` bigint not null comment '项目id',
|
||||
`violation_level` varchar(64) null comment '违章等级',
|
||||
`color` varchar(32) null comment '颜色',
|
||||
`risk_type` char(2) null comment '风险等级',
|
||||
`violation_type` varchar(255) null comment '违章类型(多个逗号分隔)',
|
||||
`create_by` varchar(64) null comment '创建者',
|
||||
`update_by` varchar(64) null comment '更新者',
|
||||
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
primary key (`id`) using btree,
|
||||
index `idx_project_id` (`project_id` asc) using btree comment '项目id'
|
||||
) comment = '违章等级' collate = utf8mb4_unicode_ci;
|
||||
|
Reference in New Issue
Block a user