This commit is contained in:
lcj
2025-11-20 09:21:41 +08:00
parent e17ab16821
commit e39e788ddc
10 changed files with 94 additions and 29 deletions

View File

@ -41,10 +41,10 @@ snail-job:
spring:
ai:
dashscope:
api-key: xxx
api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa
chat:
options:
model: qwen-plus
model: qwen3-max
datasource:
type: com.zaxxer.hikari.HikariDataSource
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content

View File

@ -63,6 +63,11 @@ public class DroDroneBigPicture extends BaseEntity {
*/
private Long recognizePic;
/**
* 识别结果
*/
private String recognizeResult;
/**
* tif文件
*/

View File

@ -86,6 +86,11 @@ public class DroDroneBigPictureVo implements Serializable {
@ExcelProperty(value = "识别结果图片")
private Long recognizePic;
/**
* 识别结果
*/
private String recognizeResult;
/**
* tif文件
*/

View File

@ -10,6 +10,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPan
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.manager.recognizermanager.vo.RecognizeConvertCoordinateResult;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo;
import java.util.Collection;
import java.util.Date;
@ -108,6 +109,5 @@ public interface IFacPhotovoltaicPanelPartsService {
* @param coordinateList 识别结果
* @param type 类型
*/
void updateFinishNumberByCoordinate(List<Long> projectIds, List<RecognizeConvertCoordinateResult> coordinateList, String type);
List<PgsProgressPlanDetailRecognizerVo> updateFinishNumberByCoordinate(List<Long> projectIds, List<RecognizeConvertCoordinateResult> coordinateList, String type);
}

View File

@ -13,6 +13,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelUpd
import org.dromara.facility.domain.vo.photovoltaicpanel.FacPhotovoltaicPanelVo;
import org.dromara.manager.recognizermanager.vo.RecognizeConvertCoordinateResult;
import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo;
import java.util.Collection;
import java.util.List;
@ -136,7 +137,7 @@ public interface IFacPhotovoltaicPanelService extends IService<FacPhotovoltaicPa
* @param coordinateList 坐标列表
* @param type 类型
*/
void updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type);
List<PgsProgressPlanDetailRecognizerVo> updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type);
}

View File

@ -36,6 +36,7 @@ import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
import org.dromara.manager.recognizermanager.vo.RecognizeConvertCoordinateResult;
import org.dromara.progress.constant.PgsProgressCategoryConstant;
import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.project.service.IBusProjectService;
import org.locationtech.jts.geom.Coordinate;
@ -826,15 +827,16 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type) {
public List<PgsProgressPlanDetailRecognizerVo> updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type) {
List<PgsProgressPlanDetailRecognizerVo> recognizeVoList = new ArrayList<>();
if (CollUtil.isEmpty(coordinateList)) {
return;
return recognizeVoList;
}
List<IdCoordinatePoint> idCoordinatePointList = getIdCoordinatePointList(projectIds, type);
if (CollUtil.isEmpty(idCoordinatePointList)) {
return;
return recognizeVoList;
}
// 判断识别出来的坐标是否包含某个点
List<Coordinate> coordinates = coordinateList.stream().map(coordinate ->
@ -843,8 +845,18 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
final double distance = 1.0;
Set<Long> matchPoints = JtsPointMatcher.matchPoints(coordinates, idCoordinatePointList, distance);
if (CollUtil.isEmpty(matchPoints)) {
return;
return recognizeVoList;
}
List<PgsProgressPlanDetailRecognizerVo> voList = idCoordinatePointList.stream()
.filter(idCoordinatePoint -> matchPoints.contains(idCoordinatePoint.getId()))
.map(idCoordinatePoint -> {
PgsProgressPlanDetailRecognizerVo vo = new PgsProgressPlanDetailRecognizerVo();
vo.setId(idCoordinatePoint.getId());
vo.setName(idCoordinatePoint.getName());
vo.setType(type);
return vo;
}).toList();
recognizeVoList.addAll(voList);
// 根据类型,更新对应数据
if (type.equals(RecognizerTypeEnum.HOLE.getValue())) {
photovoltaicPanelPointService.updateFinishNumberByCoordinate(projectIds, matchPoints);
@ -853,6 +865,7 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
} else if (type.equals(RecognizerTypeEnum.BRACKET.getValue())) {
photovoltaicPanelSupportService.updateFinishNumberByCoordinate(projectIds, matchPoints);
}
return recognizeVoList;
}
/**

View File

@ -41,6 +41,7 @@ import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.PgsProgressPlan;
import org.dromara.progress.domain.PgsProgressPlanDetail;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
import org.dromara.progress.service.IPgsProgressPlanService;
@ -765,9 +766,10 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type) {
public List<PgsProgressPlanDetailRecognizerVo> updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type) {
List<PgsProgressPlanDetailRecognizerVo> recognizeVoList = new ArrayList<>();
// 获取项目下的所有未完成的光伏板
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
@ -776,7 +778,7 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
.eq(type.equals(RecognizerTypeEnum.PANEL.getValue()), FacPhotovoltaicPanel::getProgressCategoryName, "组件安装")
.list();
if (CollUtil.isEmpty(panelList)) {
return;
return recognizeVoList;
}
// 判断识别出来的坐标是否包含在某个面内
Set<FacPhotovoltaicPanel> finishPanelList = new HashSet<>();
@ -785,6 +787,11 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
FacPhotovoltaicPanel containingPanel = JSTUtil.findContainingPanel(result, panelList);
if (containingPanel != null) {
log.info("识别到的光伏板:{}", containingPanel.getName());
PgsProgressPlanDetailRecognizerVo vo = new PgsProgressPlanDetailRecognizerVo();
vo.setId(containingPanel.getId());
vo.setName(containingPanel.getName());
vo.setType(type);
recognizeVoList.add(vo);
finishPanelList.add(containingPanel);
}
}
@ -892,6 +899,7 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
}
}
}
return recognizeVoList;
}
}

View File

@ -0,0 +1,30 @@
package org.dromara.progress.domain.vo.progressplandetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author lilemy
* @date 2025-11-19 19:08
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PgsProgressPlanDetailRecognizerVo {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 类型
*/
private String type;
}

View File

@ -46,10 +46,7 @@ import org.dromara.progress.domain.PgsProgressPlanDetail;
import org.dromara.progress.domain.dto.progressplandetail.*;
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
import org.dromara.progress.domain.vo.progressplandetail.*;
import org.dromara.progress.mapper.PgsProgressPlanDetailMapper;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
@ -1240,6 +1237,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
// 根据识别到的类型进行分组
Map<String, List<RecognizeTargetVo>> typeMap = targets.stream()
.collect(Collectors.groupingBy(RecognizeTargetVo::getType));
List<PgsProgressPlanDetailRecognizerVo> recognizerVoList = new ArrayList<>();
for (Map.Entry<String, List<RecognizeTargetVo>> entry : typeMap.entrySet()) {
String type = entry.getKey();
List<RecognizeTargetVo> value = entry.getValue();
@ -1258,13 +1256,18 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
// 处理对应设施
if (type.equals(RecognizerTypeEnum.PANEL.getValue())
|| type.equals(RecognizerTypeEnum.BRACKET.getValue())) {
photovoltaicPanelService.updateFinishNumberByCoordinate(projectIds, coordinateList, type);
List<PgsProgressPlanDetailRecognizerVo> recognizers = photovoltaicPanelService
.updateFinishNumberByCoordinate(projectIds, coordinateList, type);
recognizerVoList.addAll(recognizers);
} else if (type.equals(RecognizerTypeEnum.HOLE.getValue())
|| type.equals(RecognizerTypeEnum.COLUMN.getValue())) {
photovoltaicPanelPartsService.updateFinishNumberByCoordinate(projectIds, coordinateList, type);
List<PgsProgressPlanDetailRecognizerVo> recognizers = photovoltaicPanelPartsService
.updateFinishNumberByCoordinate(projectIds, coordinateList, type);
recognizerVoList.addAll(recognizers);
} else {
log.error("未知设施类型:{}", type);
}
}
// 将识别数据同步到图片上
Long recognizePic = null;
@ -1280,11 +1283,13 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
} catch (IOException | URISyntaxException e) {
throw new ServiceException("将识别数据同步到图片上失败", HttpStatus.ERROR);
}
String recognizerStr = JSONUtil.toJsonStr(recognizerVoList);
// 更新数据和状态
boolean update = droDroneBigPictureService.lambdaUpdate()
.eq(DroDroneBigPicture::getId, bigPictureId)
.set(DroDroneBigPicture::getStatus, "6")
.set(DroDroneBigPicture::getRecognizePic, recognizePic)
.set(DroDroneBigPicture::getRecognizeResult, recognizerStr)
.update();
if (!update) {
return CompletableFuture.completedFuture(false);

View File

@ -3,7 +3,6 @@ package org.dromara.safety.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -20,7 +19,6 @@ import org.dromara.common.sse.config.SseProperties;
import org.dromara.common.sse.dto.SeeMessageContentDto;
import org.dromara.common.sse.dto.SseMessageDto;
import org.dromara.common.sse.utils.SseMessageUtils;
import org.dromara.gps.domain.GpsEquipmentSonToGpsEquipmentSonVoMapperImpl;
import org.dromara.project.domain.BusProjectTeamMember;
import org.dromara.project.service.IBusProjectTeamMemberService;
import org.dromara.safety.domain.HseRecognizeRecord;
@ -355,7 +353,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
lqw.ge(HseViolationRecord::getViolationTime, startOfDay)
.lt(HseViolationRecord::getViolationTime, startOfNextDay);
}
lqw.eq(StringUtils.isNotBlank(req.getStatus()),HseViolationRecord::getStatus, req.getStatus());
lqw.eq(StringUtils.isNotBlank(req.getStatus()), HseViolationRecord::getStatus, req.getStatus());
lqw.orderByDesc(HseViolationRecord::getCreateTime);
return lqw;
}
@ -464,10 +462,10 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
updateRecord.setId(id);
updateRecord.setReviewTime(new Date());
updateRecord.setStatus(HseSafetyInspectionStatusEnum.REVIEW.getValue());
if(req.getReviewType().equals(HseSafetyInspectionReviewTypeEnum.UNPASS.getValue())){
if (req.getReviewType().equals(HseSafetyInspectionReviewTypeEnum.UNPASS.getValue())) {
violationRecord.setId(null);
violationRecord.setStatus(HseSafetyInspectionStatusEnum.INFORM.getValue());
violationRecord.setVersion(violationRecord.getVersion()+1);
violationRecord.setVersion(violationRecord.getVersion() + 1);
violationRecord.setMeasure(null);
violationRecord.setRectificationTime(null);
violationRecord.setRectificationFile(null);
@ -483,7 +481,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
@Override
public HseViolationRecordVo getHistory(String jobKey, Integer version) {
LambdaQueryWrapper<HseViolationRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(HseViolationRecord::getJobKey,jobKey).eq(HseViolationRecord::getVersion,version).last("limit 1");
wrapper.eq(HseViolationRecord::getJobKey, jobKey).eq(HseViolationRecord::getVersion, version).last("limit 1");
HseViolationRecord one = getOne(wrapper);
return getVo(one);
}