进度计划

This commit is contained in:
lcj
2025-09-22 22:10:04 +08:00
parent 683f58cdc8
commit d72f763545
17 changed files with 170 additions and 109 deletions

View File

@ -16,6 +16,8 @@ import org.dromara.design.service.IDesTechnicalStandardService;
import org.dromara.facility.domain.FacMatrix;
import org.dromara.facility.service.IFacMatrixService;
import org.dromara.facility.service.IFacPhotovoltaicPanelPartsService;
import org.dromara.facility.service.IFacPhotovoltaicPanelService;
import org.dromara.manager.recognizermanager.vo.RecognizeConvertCoordinateResult;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
@ -73,6 +75,9 @@ public class DemoTest {
@Resource
private IdCardEncryptorUtil idCardEncryptorUtil;
@Resource
private IFacPhotovoltaicPanelService photovoltaicPanelService;
@Test
void testConstructionValue() {
progressPlanDetailService.syncPlanDetail2ConstructionValue(LocalDate.now().minusDays(1), null);
@ -170,4 +175,10 @@ public class DemoTest {
}
}
@Test
void testImport(){
photovoltaicPanelService.updateFinishNumberByCoordinate(List.of(1968510961294921730L),
List.of(new RecognizeConvertCoordinateResult("107.124334530","23.830557974")));
}
}

View File

@ -1,21 +1,19 @@
package org.dromara.bigscreen.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.bigscreen.domain.*;
import org.dromara.bigscreen.domain.vo.*;
import org.dromara.bigscreen.mapper.ProjectBigScreenMapper;
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
import org.dromara.bigscreen.domain.vo.ProjectLandVo;
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
import org.dromara.bigscreen.service.ProjectBigScreenService;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.DateUtils;
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.utils.BigDecimalUtil;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
import org.dromara.gps.service.IGpsEquipmentService;
@ -26,16 +24,20 @@ import org.dromara.land.service.IBusLandTransferLedgerService;
import org.dromara.manager.weathermanager.vo.WeatherVo;
import org.dromara.other.domain.OthYs7Device;
import org.dromara.other.service.IOthYs7DeviceService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
import org.dromara.project.service.IBusProjectNewsService;
import org.dromara.project.service.IBusProjectService;
import org.dromara.quality.domain.dto.qualityinspection.QltQualityInspectionGisReq;
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionListGisVo;
import org.dromara.quality.service.IQltQualityInspectionService;
import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionGisReq;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
import org.dromara.safety.service.IHseSafetyInspectionService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -65,12 +67,14 @@ public class ProjectBigScreenController {
private final IOthYs7DeviceService othYs7DeviceService;
private final ProjectBigScreenMapper projectBigScreenMapper;
private final IBusProjectService projectService;
private final IBusProjectNewsService projectNewsService;
private final IQltQualityInspectionService qualityInspectionService;
private final IHseSafetyInspectionService safetyInspectionService;
/**
* 查询项目土地统计
*/
@ -323,7 +327,7 @@ public class ProjectBigScreenController {
gpsMap.put("children", gpsChildrenMap);
sxtMap.put("id", 2);
sxtMap.put("label", "摄像头");
sxtMap.put("children",sxtChildrenMap);
sxtMap.put("children", sxtChildrenMap);
// sxtMap.put("children", maps1);
wrjMap.put("id", 3);
wrjMap.put("label", "无人机");
@ -337,6 +341,21 @@ public class ProjectBigScreenController {
return R.ok(maps);
}
/**
* 查询质量信息
*/
@GetMapping("/getQualityList/gis")
public R<QltQualityInspectionListGisVo> queryGisList(QltQualityInspectionGisReq req) {
return R.ok(qualityInspectionService.queryGisList(req));
}
/**
* 查询大屏安全信息
*/
@GetMapping("/getSafetyList/gis")
public R<HseSafetyInspectionListGisVo> queryGisList(HseSafetyInspectionGisReq req) {
return R.ok(safetyInspectionService.queryGisList(req));
}
/**
* 查询GPS设备用户列表
@ -363,18 +382,17 @@ public class ProjectBigScreenController {
*/
// @SaCheckPermission("project:bigScreen:getProjectMapList")
@GetMapping("/getProjectMapList")
public R<Map<String,Map<String,Map<String,String>>>> getProjectMapList() {
public R<Map<String, Map<String, Map<String, String>>>> getProjectMapList() {
return R.ok(projectService.getProjectMapList());
}
/**
* 查询项目地域分散图
*/
// @SaCheckPermission("project:bigScreen:getProjectMapList")
@GetMapping("/getProjectDiYv")
public R<Map<String,Long>> getProjectDiYv() {
public R<Map<String, Long>> getProjectDiYv() {
return R.ok(projectService.getProjectDiYv());
}
@ -383,7 +401,7 @@ public class ProjectBigScreenController {
*/
// @SaCheckPermission("project:bigScreen:getProjectMapList")
@GetMapping("/getProjectCapacity")
public R<Map<String,Map<String,String>>> getProjectCapacity() {
public R<Map<String, Map<String, String>>> getProjectCapacity() {
return R.ok(projectService.getProjectCapacity());
}

View File

@ -120,8 +120,8 @@ public interface IFacPhotovoltaicPanelColumnService extends IService<FacPhotovol
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints);
void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints);
}

View File

@ -104,10 +104,10 @@ public interface IFacPhotovoltaicPanelPartsService {
/**
* 根据识别结果更新光伏板点完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param coordinateList 识别结果
* @param type 类型
*/
void updateFinishNumberByCoordinate(Long projectId, List<RecognizeConvertCoordinateResult> coordinateList, String type);
void updateFinishNumberByCoordinate(List<Long> projectIds, List<RecognizeConvertCoordinateResult> coordinateList, String type);
}

View File

@ -120,8 +120,8 @@ public interface IFacPhotovoltaicPanelPointService extends IService<FacPhotovolt
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints);
void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints);
}

View File

@ -132,8 +132,8 @@ public interface IFacPhotovoltaicPanelService extends IService<FacPhotovoltaicPa
/**
* 根据坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param coordinateList 坐标列表
*/
void updateFinishNumberByCoordinate(Long projectId, List<RecognizeConvertCoordinateResult> coordinateList);
void updateFinishNumberByCoordinate(List<Long> projectIds, List<RecognizeConvertCoordinateResult> coordinateList);
}

View File

@ -120,8 +120,8 @@ public interface IFacPhotovoltaicPanelSupportService extends IService<FacPhotovo
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints);
void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints);
}

View File

@ -416,12 +416,12 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints) {
public void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints) {
// 获取数据
List<FacPhotovoltaicPanelColumn> finishList = this.listByIds(matchPoints);
// 更新完成状态
@ -437,11 +437,12 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
LocalDate now = LocalDate.now();
for (Map.Entry<Long, List<FacPhotovoltaicPanelColumn>> entry : mapByCategory.entrySet()) {
Long categoryId = entry.getKey();
PgsProgressCategory category = progressCategoryService.getById(categoryId);
List<FacPhotovoltaicPanelColumn> categoryList = entry.getValue();
// 计算数量
BigDecimal size = BigDecimal.valueOf(categoryList.size());
PgsProgressPlanDetail planDetail = progressPlanDetailService.lambdaQuery()
.eq(PgsProgressPlanDetail::getProjectId, projectId)
.in(PgsProgressPlanDetail::getProjectId, projectIds)
.eq(PgsProgressPlanDetail::getProgressCategoryId, categoryId)
.eq(PgsProgressPlanDetail::getDate, now)
.one();
@ -476,19 +477,17 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
throw new ServiceException("更新进度计划失败,数据库操作失败", HttpStatus.ERROR);
}
// 更新进度数量
PgsProgressCategory category = new PgsProgressCategory();
category.setId(categoryId);
category.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(category);
PgsProgressCategory newCategory = new PgsProgressCategory();
newCategory.setId(categoryId);
newCategory.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(newCategory);
if (!result3) {
throw new ServiceException("更新进度类别失败,数据库操作失败", HttpStatus.ERROR);
}
} else {
// 如果不存在,获取类别详情
PgsProgressCategory category = progressCategoryService.getById(categoryId);
// 则创建计划
// 如果不存在,则创建计划
PgsProgressPlan plan = new PgsProgressPlan();
plan.setProjectId(projectId);
plan.setProjectId(category.getProjectId());
plan.setMatrixId(category.getMatrixId());
plan.setMatrixName(category.getMatrixName());
plan.setProgressCategoryId(categoryId);
@ -504,7 +503,7 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
}
// 创建计划详情
PgsProgressPlanDetail newPlanDetail = new PgsProgressPlanDetail();
newPlanDetail.setProjectId(projectId);
newPlanDetail.setProjectId(category.getProjectId());
newPlanDetail.setProgressPlanId(plan.getId());
newPlanDetail.setProgressCategoryId(categoryId);
newPlanDetail.setDate(now);

View File

@ -820,19 +820,19 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
/**
* 根据识别结果更新光伏板点完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param coordinateList 识别结果
* @param type 类型
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(Long projectId,
public void updateFinishNumberByCoordinate(List<Long> projectIds,
List<RecognizeConvertCoordinateResult> coordinateList,
String type) {
if (CollUtil.isEmpty(coordinateList)) {
return;
}
List<IdCoordinatePoint> idCoordinatePointList = getIdCoordinatePointList(projectId, type);
List<IdCoordinatePoint> idCoordinatePointList = getIdCoordinatePointList(projectIds, type);
if (CollUtil.isEmpty(idCoordinatePointList)) {
return;
}
@ -846,25 +846,25 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
}
// 根据类型,更新对应数据
if (type.equals(RecognizerTypeEnum.HOLE.getValue())) {
photovoltaicPanelPointService.updateFinishNumberByCoordinate(projectId, matchPoints);
photovoltaicPanelPointService.updateFinishNumberByCoordinate(projectIds, matchPoints);
} else if (type.equals(RecognizerTypeEnum.PILE.getValue())) {
photovoltaicPanelColumnService.updateFinishNumberByCoordinate(projectId, matchPoints);
photovoltaicPanelColumnService.updateFinishNumberByCoordinate(projectIds, matchPoints);
} else if (type.equals(RecognizerTypeEnum.SHELVES.getValue())) {
photovoltaicPanelSupportService.updateFinishNumberByCoordinate(projectId, matchPoints);
photovoltaicPanelSupportService.updateFinishNumberByCoordinate(projectIds, matchPoints);
}
}
/**
* 获取指定项目指定类型数据
*
* @param projectId 项目id
* @param type 类型
* @param projectIds 项目id列表
* @param type 类型
* @return id、坐标
*/
private List<IdCoordinatePoint> getIdCoordinatePointList(Long projectId, String type) {
private List<IdCoordinatePoint> getIdCoordinatePointList(List<Long> projectIds, String type) {
if (type.equals(RecognizerTypeEnum.HOLE.getValue())) {
List<FacPhotovoltaicPanelPoint> list = photovoltaicPanelPointService.lambdaQuery()
.eq(FacPhotovoltaicPanelPoint::getProjectId, projectId)
.in(FacPhotovoltaicPanelPoint::getProjectId, projectIds)
.ne(FacPhotovoltaicPanelPoint::getStatus, FacFinishStatusEnum.FINISH.getValue())
.list();
if (CollUtil.isNotEmpty(list)) {
@ -873,7 +873,7 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
}
} else if (type.equals(RecognizerTypeEnum.PILE.getValue())) {
List<FacPhotovoltaicPanelColumn> list = photovoltaicPanelColumnService.lambdaQuery()
.eq(FacPhotovoltaicPanelColumn::getProjectId, projectId)
.in(FacPhotovoltaicPanelColumn::getProjectId, projectIds)
.ne(FacPhotovoltaicPanelColumn::getStatus, FacFinishStatusEnum.FINISH.getValue())
.list();
if (CollUtil.isNotEmpty(list)) {
@ -882,7 +882,7 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
}
} else if (type.equals(RecognizerTypeEnum.SHELVES.getValue())) {
List<FacPhotovoltaicPanelSupport> list = photovoltaicPanelSupportService.lambdaQuery()
.eq(FacPhotovoltaicPanelSupport::getProjectId, projectId)
.in(FacPhotovoltaicPanelSupport::getProjectId, projectIds)
.ne(FacPhotovoltaicPanelSupport::getStatus, FacFinishStatusEnum.FINISH.getValue())
.list();
if (CollUtil.isNotEmpty(list)) {

View File

@ -416,12 +416,12 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints) {
public void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints) {
// 获取数据
List<FacPhotovoltaicPanelPoint> finishList = this.listByIds(matchPoints);
// 更新完成状态
@ -437,11 +437,12 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
LocalDate now = LocalDate.now();
for (Map.Entry<Long, List<FacPhotovoltaicPanelPoint>> entry : mapByCategory.entrySet()) {
Long categoryId = entry.getKey();
PgsProgressCategory category = progressCategoryService.getById(categoryId);
List<FacPhotovoltaicPanelPoint> categoryList = entry.getValue();
// 计算数量
BigDecimal size = BigDecimal.valueOf(categoryList.size());
PgsProgressPlanDetail planDetail = progressPlanDetailService.lambdaQuery()
.eq(PgsProgressPlanDetail::getProjectId, projectId)
.in(PgsProgressPlanDetail::getProjectId, projectIds)
.eq(PgsProgressPlanDetail::getProgressCategoryId, categoryId)
.eq(PgsProgressPlanDetail::getDate, now)
.one();
@ -476,19 +477,17 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
throw new ServiceException("更新进度计划失败,数据库操作失败", HttpStatus.ERROR);
}
// 更新进度数量
PgsProgressCategory category = new PgsProgressCategory();
category.setId(categoryId);
category.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(category);
PgsProgressCategory newCategory = new PgsProgressCategory();
newCategory.setId(categoryId);
newCategory.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(newCategory);
if (!result3) {
throw new ServiceException("更新进度类别失败,数据库操作失败", HttpStatus.ERROR);
}
} else {
// 如果不存在,获取类别详情
PgsProgressCategory category = progressCategoryService.getById(categoryId);
// 则创建计划
// 如果不存在,则创建计划
PgsProgressPlan plan = new PgsProgressPlan();
plan.setProjectId(projectId);
plan.setProjectId(category.getProjectId());
plan.setMatrixId(category.getMatrixId());
plan.setMatrixName(category.getMatrixName());
plan.setProgressCategoryId(categoryId);
@ -504,7 +503,7 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
}
// 创建计划详情
PgsProgressPlanDetail newPlanDetail = new PgsProgressPlanDetail();
newPlanDetail.setProjectId(projectId);
newPlanDetail.setProjectId(category.getProjectId());
newPlanDetail.setProgressPlanId(plan.getId());
newPlanDetail.setProgressCategoryId(categoryId);
newPlanDetail.setDate(now);

View File

@ -754,15 +754,15 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
/**
* 根据坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param coordinateList 坐标列表
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(Long projectId, List<RecognizeConvertCoordinateResult> coordinateList) {
public void updateFinishNumberByCoordinate(List<Long> projectIds, List<RecognizeConvertCoordinateResult> coordinateList) {
// 获取项目下的所有未完成的光伏板
List<FacPhotovoltaicPanel> panelList = this.lambdaQuery()
.eq(FacPhotovoltaicPanel::getProjectId, projectId)
.in(FacPhotovoltaicPanel::getProjectId, projectIds)
.ne(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.FINISH.getValue())
.list();
if (CollUtil.isEmpty(panelList)) {
@ -791,11 +791,12 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
LocalDate now = LocalDate.now();
for (Map.Entry<Long, List<FacPhotovoltaicPanel>> entry : mapByCategory.entrySet()) {
Long categoryId = entry.getKey();
PgsProgressCategory category = progressCategoryService.getById(categoryId);
List<FacPhotovoltaicPanel> categoryList = entry.getValue();
// 计算数量
BigDecimal size = BigDecimal.valueOf(categoryList.size());
PgsProgressPlanDetail planDetail = progressPlanDetailService.lambdaQuery()
.eq(PgsProgressPlanDetail::getProjectId, projectId)
.eq(PgsProgressPlanDetail::getProjectId, category.getProjectId())
.eq(PgsProgressPlanDetail::getProgressCategoryId, categoryId)
.eq(PgsProgressPlanDetail::getDate, now)
.one();
@ -830,19 +831,17 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
throw new ServiceException("更新进度计划失败,数据库操作失败", HttpStatus.ERROR);
}
// 更新进度数量
PgsProgressCategory category = new PgsProgressCategory();
category.setId(categoryId);
category.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(category);
PgsProgressCategory newCategory = new PgsProgressCategory();
newCategory.setId(categoryId);
newCategory.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(newCategory);
if (!result3) {
throw new ServiceException("更新进度类别失败,数据库操作失败", HttpStatus.ERROR);
}
} else {
// 如果不存在,获取类别详情
PgsProgressCategory category = progressCategoryService.getById(categoryId);
// 则创建计划
// 如果不存在,则创建计划
PgsProgressPlan plan = new PgsProgressPlan();
plan.setProjectId(projectId);
plan.setProjectId(category.getProjectId());
plan.setMatrixId(category.getMatrixId());
plan.setMatrixName(category.getMatrixName());
plan.setProgressCategoryId(categoryId);
@ -858,7 +857,7 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
}
// 创建计划详情
PgsProgressPlanDetail newPlanDetail = new PgsProgressPlanDetail();
newPlanDetail.setProjectId(projectId);
newPlanDetail.setProjectId(category.getProjectId());
newPlanDetail.setProgressPlanId(plan.getId());
newPlanDetail.setProgressCategoryId(categoryId);
newPlanDetail.setDate(now);

View File

@ -416,12 +416,12 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
/**
* 根据AI识别坐标更新完成数量
*
* @param projectId 项目id
* @param projectIds 项目id列表
* @param matchPoints 匹配的坐标点id
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFinishNumberByCoordinate(Long projectId, List<Long> matchPoints) {
public void updateFinishNumberByCoordinate(List<Long> projectIds, List<Long> matchPoints) {
// 获取数据
List<FacPhotovoltaicPanelSupport> finishList = this.listByIds(matchPoints);
// 更新完成状态
@ -437,11 +437,12 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
LocalDate now = LocalDate.now();
for (Map.Entry<Long, List<FacPhotovoltaicPanelSupport>> entry : mapByCategory.entrySet()) {
Long categoryId = entry.getKey();
PgsProgressCategory category = progressCategoryService.getById(categoryId);
List<FacPhotovoltaicPanelSupport> categoryList = entry.getValue();
// 计算数量
BigDecimal size = BigDecimal.valueOf(categoryList.size());
PgsProgressPlanDetail planDetail = progressPlanDetailService.lambdaQuery()
.eq(PgsProgressPlanDetail::getProjectId, projectId)
.in(PgsProgressPlanDetail::getProjectId, projectIds)
.eq(PgsProgressPlanDetail::getProgressCategoryId, categoryId)
.eq(PgsProgressPlanDetail::getDate, now)
.one();
@ -476,19 +477,17 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
throw new ServiceException("更新进度计划失败,数据库操作失败", HttpStatus.ERROR);
}
// 更新进度数量
PgsProgressCategory category = new PgsProgressCategory();
category.setId(categoryId);
category.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(category);
PgsProgressCategory newCategory = new PgsProgressCategory();
newCategory.setId(categoryId);
newCategory.setCompleted(category.getCompleted().add(size));
boolean result3 = progressCategoryService.updateById(newCategory);
if (!result3) {
throw new ServiceException("更新进度类别失败,数据库操作失败", HttpStatus.ERROR);
}
} else {
// 如果不存在,获取类别详情
PgsProgressCategory category = progressCategoryService.getById(categoryId);
// 则创建计划
// 如果不存在,则创建计划
PgsProgressPlan plan = new PgsProgressPlan();
plan.setProjectId(projectId);
plan.setProjectId(category.getProjectId());
plan.setMatrixId(category.getMatrixId());
plan.setMatrixName(category.getMatrixName());
plan.setProgressCategoryId(categoryId);
@ -504,7 +503,7 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
}
// 创建计划详情
PgsProgressPlanDetail newPlanDetail = new PgsProgressPlanDetail();
newPlanDetail.setProjectId(projectId);
newPlanDetail.setProjectId(category.getProjectId());
newPlanDetail.setProgressPlanId(plan.getId());
newPlanDetail.setProgressCategoryId(categoryId);
newPlanDetail.setDate(now);

View File

@ -1,6 +1,7 @@
package org.dromara.progress.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
@ -22,6 +23,8 @@ import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.dto.progresscategory.*;
import org.dromara.progress.domain.vo.progresscategory.*;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.service.IBusProjectService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -49,6 +52,9 @@ public class PgsProgressCategoryController extends BaseController {
@Resource
private IPgsProgressCategoryService pgsProgressCategoryService;
@Resource
private IBusProjectService projectService;
/**
* 查询进度类别列表
*/
@ -177,6 +183,12 @@ public class PgsProgressCategoryController extends BaseController {
return R.fail("文件名不能为空");
}
// 获取项目
List<BusProject> projects = projectService.lambdaQuery()
.eq(BusProject::getPId, 1897160897167638529L)
.list();
List<Long> ids = projects.stream().map(BusProject::getId).toList();
try {
// 使用EasyExcel读取所有sheet
List<PgsProgressCategoryVo> allData = new ArrayList<>();
@ -199,15 +211,30 @@ public class PgsProgressCategoryController extends BaseController {
EasyExcel.read(file.getInputStream(), PgsProgressCategoryVo.class, sheetListener)
.sheet(readSheet.getSheetNo())
.doRead();
List<PgsProgressCategoryVo> list = sheetListener.getExcelResult().getList();
List<PgsProgressCategoryVo> newList = list.stream().filter(vo -> vo.getId() == null).toList();
List<PgsProgressCategoryVo> oldList = list.stream().filter(vo -> vo.getId() != null).toList();
// 将当前sheet的数据添加到总数据中
allData.addAll(sheetListener.getExcelResult().getList());
allData.addAll(oldList);
if (CollUtil.isNotEmpty(newList)) {
if (CollUtil.isNotEmpty(oldList)) {
PgsProgressCategoryVo first = oldList.getFirst();
PgsProgressCategory category = pgsProgressCategoryService.getById(first.getId());
newList.forEach(vo -> {
vo.setParentId(category.getParentId());
vo.setProjectId(category.getProjectId());
vo.setMatrixId(category.getMatrixId());
vo.setAncestors(category.getAncestors());
vo.setRelevancyStructure(category.getRelevancyStructure());
});
allData.addAll(newList);
}
}
}
// 关闭读取器
excelReader.finish();
return R.ok();
/*if (allData.isEmpty()) {
if (allData.isEmpty()) {
return R.fail("未读取到有效数据");
}
// 处理导入的数据
@ -228,15 +255,18 @@ public class PgsProgressCategoryController extends BaseController {
pgsProgressCategory.setConstructionOutputValue(constructionPrice.multiply(total).setScale(4, RoundingMode.HALF_UP));
}
}
// 关联数据不更新数量
if (pgsProgressCategory.getRemark() != null && pgsProgressCategory.getRemark().equals("关联数据")) {
pgsProgressCategory.setTotal(null);
}
});
boolean b = pgsProgressCategoryService.updateBatchById(list);
boolean b = pgsProgressCategoryService.saveOrUpdateBatch(list);
if (!b) {
return R.fail("更新失败");
}
return R.ok("导入成功,共更新 " + list.size() + " 条数据");*/
return R.ok("导入成功,共更新 " + list.size() + " 条数据");
} catch (Exception e) {
log.error("导入Excel文件失败", e);
return R.fail("导入失败: " + e.getMessage());

View File

@ -1,6 +1,5 @@
package org.dromara.progress.domain.dto.progresscategory;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

View File

@ -108,6 +108,9 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
@Resource
private IFacPhotovoltaicPanelColumnService photovoltaicPanelColumnService;
@Resource
private IFacPhotovoltaicPanelPartsService photovoltaicPanelPartsService;
@Resource
private IOutConstructionValueService constructionValueService;
@ -922,9 +925,19 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
public Boolean insertNumberDetailByAI(PgsProgressPlanDetailAINumberReq req) {
String file = req.getFile();
String tif = req.getTif();
String fileUrl = droneBigImageProperties.getUrl() + file;
String tifUrl = droneBigImageProperties.getUrl() + tif;
// String fileUrl = droneBigImageProperties.getUrl() + file;
// String tifUrl = droneBigImageProperties.getUrl() + tif;
String fileUrl = file;
String tifUrl = tif;
Long projectId = req.getProjectId();
// 获取所有子项
List<BusProject> projects = projectService.lambdaQuery()
.eq(BusProject::getPId, projectId)
.list();
if (CollUtil.isEmpty(projects)) {
return true;
}
List<Long> projectIds = projects.stream().map(BusProject::getId).distinct().toList();
// 识别类型:洞、桩、架、架子
List<RecognizerTypeEnum> enumList = List.of(RecognizerTypeEnum.HOLE, RecognizerTypeEnum.PHO,
RecognizerTypeEnum.PILE, RecognizerTypeEnum.SHELVES);
@ -965,13 +978,11 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
log.info("类型:{},识别到的设施:{},转换坐标:{}", type, value, coordinateList);
// 处理对应设施
if (type.equals(RecognizerTypeEnum.PHO.getValue())) {
photovoltaicPanelService.updateFinishNumberByCoordinate(projectId, coordinateList);
} else if (type.equals(RecognizerTypeEnum.HOLE.getValue())) {
} else if (type.equals(RecognizerTypeEnum.PILE.getValue())) {
} else if (type.equals(RecognizerTypeEnum.SHELVES.getValue())) {
photovoltaicPanelService.updateFinishNumberByCoordinate(projectIds, coordinateList);
} else if (type.equals(RecognizerTypeEnum.HOLE.getValue())
|| type.equals(RecognizerTypeEnum.PILE.getValue())
|| type.equals(RecognizerTypeEnum.SHELVES.getValue())) {
photovoltaicPanelPartsService.updateFinishNumberByCoordinate(projectIds, coordinateList, type);
} else {
log.error("未知设施类型:{}", type);
}

View File

@ -1,6 +1,5 @@
package org.dromara.quality.domain.vo.qualityinspection;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -34,9 +33,6 @@ public class QltQualityInspectionGis {
/**
* 创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd",
timezone = "GMT+8")
private Date createTime;
}

View File

@ -5,7 +5,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.time.LocalDateTime;
/**
* @author lilemy
@ -37,6 +37,6 @@ public class HseTeamMeetingGis {
@JsonFormat(shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd",
timezone = "GMT+8")
private Date meetingDate;
private LocalDateTime meetingDate;
}