添加抓拍,修改项目大屏
This commit is contained in:
@ -167,7 +167,7 @@ public class ProjectBigScreenController extends BaseController {
|
||||
// vo.setContent(event.getContent());
|
||||
// return vo;
|
||||
// }).toList());
|
||||
return R.ok(projectNewsService.getLimtVoByProjectId(projectId));
|
||||
return R.ok(projectBigScreenService.getProjectNews(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -221,7 +221,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
return vo;
|
||||
}
|
||||
// 子项目id列表
|
||||
List<Long> subProjectIds = subProjectList.stream().map(BusProject::getId).toList();
|
||||
List<Long> projectIds = new ArrayList<>(subProjectList.stream().map(BusProject::getId).toList());
|
||||
// 计算集电线路
|
||||
vo.setCollectorLinePercentage(BigDecimal.valueOf(0.00));
|
||||
// 计算送出线路
|
||||
@ -235,8 +235,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
// 计算箱变
|
||||
vo.setBoxTransformerPercentage(BigDecimal.ZERO);
|
||||
// 获取集电线路、送出线路、升压站数据
|
||||
projectIds.add(projectId);
|
||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.in(PgsProgressCategory::getName, "集电线路", "送出线路", "升压站", "光伏场区")
|
||||
.eq(PgsProgressCategory::getParentId, 0L)
|
||||
.list();
|
||||
@ -304,7 +305,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
}
|
||||
// 计算道路
|
||||
List<PgsProgressCategory> roadCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.like(PgsProgressCategory::getName, "道路")
|
||||
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||
.list();
|
||||
@ -316,7 +317,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
}
|
||||
// 计算箱变
|
||||
List<PgsProgressCategory> boxTransformerCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.like(PgsProgressCategory::getName, "箱变")
|
||||
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||
.list();
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2025/6/18 15:59
|
||||
*/
|
||||
@Slf4j
|
||||
//@Component
|
||||
@Component
|
||||
public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
@Resource
|
||||
@ -43,8 +43,8 @@ public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
// 每 30 分钟执行一次
|
||||
@Scheduled(cron = "0 */30 7-19 * * ?")
|
||||
// 每 15 分钟执行一次
|
||||
@Scheduled(cron = "0 */15 7-19 * * ?")
|
||||
public void run() {
|
||||
// 查询所有在线的摄像头设备,仅获取必要字段
|
||||
List<OthYs7Device> deviceList = ys7DeviceService.lambdaQuery()
|
||||
|
||||
@ -102,7 +102,7 @@ public class OthYs7DeviceController extends BaseController {
|
||||
/**
|
||||
* 修改萤石摄像头所属项目
|
||||
*/
|
||||
@SaCheckPermission("other:ys7Device:withProject")
|
||||
@SaCheckPermission("other:ys7Device:edit")
|
||||
@Log(title = "萤石摄像头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/with/project")
|
||||
@ -113,7 +113,7 @@ public class OthYs7DeviceController extends BaseController {
|
||||
/**
|
||||
* 修改萤石摄像头视频加密
|
||||
*/
|
||||
@SaCheckPermission("other:ys7Device:videoEncrypted")
|
||||
@SaCheckPermission("other:ys7Device:edit")
|
||||
@Log(title = "萤石摄像头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/video/encrypted")
|
||||
|
||||
@ -12,6 +12,7 @@ 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.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
@ -66,6 +67,16 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
return R.ok(othYs7DeviceImgService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 萤石摄像头图片抓图
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:capture")
|
||||
@Log(title = "萤石摄像头图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/capture")
|
||||
public R<Void> capture(@RequestBody OthYs7DeviceImgCaptureReq req) {
|
||||
return toAjax(othYs7DeviceImgService.capturePic(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除萤石摄像头图片
|
||||
*
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package org.dromara.other.domain.dto.ys7deviceimg;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-10-10 19:14
|
||||
*/
|
||||
@Data
|
||||
public class OthYs7DeviceImgCaptureReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 678123111752523000L;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@NotBlank(message = "设备序列号不能为空")
|
||||
private String deviceSerial;
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.other.domain.OthYs7DeviceImg;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCreateByCapture;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
@ -93,4 +94,12 @@ public interface IOthYs7DeviceImgService extends IService<OthYs7DeviceImg> {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 抓拍图片
|
||||
*
|
||||
* @param req 抓拍图片参数
|
||||
* @return 是否抓拍成功
|
||||
*/
|
||||
Boolean capturePic(OthYs7DeviceImgCaptureReq req);
|
||||
}
|
||||
|
||||
@ -20,13 +20,17 @@ import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeImageStreamResult;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeTargetVo;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
||||
import org.dromara.manager.ys7manager.Ys7Manager;
|
||||
import org.dromara.other.constant.Ys7DeviceImgConstant;
|
||||
import org.dromara.other.domain.OthYs7Device;
|
||||
import org.dromara.other.domain.OthYs7DeviceImg;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
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 org.dromara.other.mapper.OthYs7DeviceImgMapper;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
import org.dromara.other.service.IOthYs7DeviceService;
|
||||
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordCreateDto;
|
||||
import org.dromara.safety.domain.enums.HseRecordCategoryEnum;
|
||||
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||
@ -62,6 +66,12 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
@Resource
|
||||
private IHseRecognizeRecordService recognizeRecordService;
|
||||
|
||||
@Resource
|
||||
private IOthYs7DeviceService ys7DeviceService;
|
||||
|
||||
@Resource
|
||||
private Ys7Manager ys7Manager;
|
||||
|
||||
/**
|
||||
* 查询萤石摄像头图片
|
||||
*
|
||||
@ -317,6 +327,40 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 抓拍图片
|
||||
*
|
||||
* @param req 抓拍图片参数
|
||||
* @return 是否抓拍成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean capturePic(OthYs7DeviceImgCaptureReq req) {
|
||||
OthYs7Device ys7Device = ys7DeviceService.lambdaQuery()
|
||||
.eq(OthYs7Device::getDeviceSerial, req.getDeviceSerial())
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if (ys7Device == null) {
|
||||
throw new ServiceException("设备不存在", HttpStatus.ERROR);
|
||||
}
|
||||
String deviceSerial = ys7Device.getDeviceSerial();
|
||||
// 如果没有预置位,则直接对默认通道抓图
|
||||
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
||||
img.setProjectId(ys7Device.getProjectId());
|
||||
img.setDeviceSerial(deviceSerial);
|
||||
img.setDeviceName(ys7Device.getDeviceName());
|
||||
try {
|
||||
String url = ys7Manager.getCaptureDevicePic(deviceSerial, 1, 2);
|
||||
img.setCreateTime(new Date());
|
||||
img.setUrl(url);
|
||||
} catch (Exception e) {
|
||||
log.error("摄像头 {} 抓图失败:{}", deviceSerial, e.getMessage());
|
||||
throw new ServiceException("摄像头 " + deviceSerial + " 抓图失败:" + e.getMessage(), HttpStatus.ERROR);
|
||||
}
|
||||
this.saveCapturePic(List.of(img));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取文件名
|
||||
*
|
||||
|
||||
@ -189,30 +189,34 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
List<HseTeamMeeting> teamMeetings = teamMeetingService.lambdaQuery()
|
||||
.eq(HseTeamMeeting::getProjectId, projectId)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(teamMeetings)) {
|
||||
return gisVo;
|
||||
if (CollUtil.isNotEmpty(teamMeetings)) {
|
||||
// 获取最新的班组列表
|
||||
List<HseTeamMeeting> topList = teamMeetings.stream()
|
||||
.sorted(Comparator.comparing(HseTeamMeeting::getCreateTime).reversed())
|
||||
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
|
||||
.toList();
|
||||
List<Long> teamIds = topList.stream().map(HseTeamMeeting::getTeamId).toList();
|
||||
Map<Long, List<BusProjectTeam>> teamMap = projectTeamService.lambdaQuery()
|
||||
.in(BusProjectTeam::getId, teamIds)
|
||||
.list().stream().collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
List<HseTeamMeetingGis> gisList = topList.stream().map(teamMeeting -> {
|
||||
HseTeamMeetingGis gis = new HseTeamMeetingGis();
|
||||
BeanUtils.copyProperties(teamMeeting, gis);
|
||||
gis.setName("站班会");
|
||||
if (teamMap.containsKey(teamMeeting.getTeamId())) {
|
||||
gis.setTeamName(teamMap.get(teamMeeting.getTeamId()).getFirst().getTeamName());
|
||||
}
|
||||
return gis;
|
||||
}).toList();
|
||||
gisVo.setTeamMeetingList(gisList);
|
||||
} else {
|
||||
gisVo.setTeamMeetingList(new ArrayList<>());
|
||||
}
|
||||
// 获取最新的班组列表
|
||||
List<HseTeamMeeting> topList = teamMeetings.stream()
|
||||
.sorted(Comparator.comparing(HseTeamMeeting::getCreateTime).reversed())
|
||||
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
|
||||
.toList();
|
||||
List<Long> teamIds = topList.stream().map(HseTeamMeeting::getTeamId).toList();
|
||||
Map<Long, List<BusProjectTeam>> teamMap = projectTeamService.lambdaQuery()
|
||||
.in(BusProjectTeam::getId, teamIds)
|
||||
.list().stream().collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
List<HseTeamMeetingGis> gisList = topList.stream().map(teamMeeting -> {
|
||||
HseTeamMeetingGis gis = new HseTeamMeetingGis();
|
||||
BeanUtils.copyProperties(teamMeeting, gis);
|
||||
gis.setName("站班会");
|
||||
if (teamMap.containsKey(teamMeeting.getTeamId())) {
|
||||
gis.setTeamName(teamMap.get(teamMeeting.getTeamId()).getFirst().getTeamName());
|
||||
}
|
||||
return gis;
|
||||
}).toList();
|
||||
// 获取整改情况
|
||||
List<HseSafetyInspection> safetyInspectionList = this.lambdaQuery()
|
||||
.eq(HseSafetyInspection::getProjectId, projectId).list();
|
||||
.select(HseSafetyInspection::getId, HseSafetyInspection::getStatus, HseSafetyInspection::getIsReply)
|
||||
.eq(HseSafetyInspection::getProjectId, projectId)
|
||||
.list();
|
||||
long passCount = 0L;
|
||||
for (HseSafetyInspection safetyInspection : safetyInspectionList) {
|
||||
if (HseSafetyInspectionStatusEnum.REVIEW.getValue().equals(safetyInspection.getStatus())
|
||||
@ -220,11 +224,18 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
passCount++;
|
||||
}
|
||||
}
|
||||
gisVo.setTeamMeetingList(gisList);
|
||||
int safetyInspectionCount = safetyInspectionList.stream()
|
||||
.filter(inspection -> inspection.getIsReply().equals("2"))
|
||||
.toList()
|
||||
.size();
|
||||
int correctSituationCount = safetyInspectionList.stream()
|
||||
.filter(inspection -> inspection.getIsReply().equals("1") && !inspection.getStatus().equals("1"))
|
||||
.toList()
|
||||
.size();
|
||||
gisVo.setTeamMeetingCount((long) teamMeetings.size());
|
||||
gisVo.setSafetyInspectionCount((long) safetyInspectionList.size());
|
||||
gisVo.setCorrectSituationCount(passCount);
|
||||
gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / safetyInspectionList.size()));
|
||||
gisVo.setSafetyInspectionCount((long) safetyInspectionCount);
|
||||
gisVo.setCorrectSituationCount((long) correctSituationCount);
|
||||
gisVo.setCorrectSituation(String.format("%.2f", correctSituationCount * 100.0 / safetyInspectionCount));
|
||||
return gisVo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user