From a52b9078a07ad74b877b00d3ce19453768822282 Mon Sep 17 00:00:00 2001 From: dfdg <2710245601@qq.com> Date: Tue, 9 Sep 2025 17:47:49 +0800 Subject: [PATCH] =?UTF-8?q?gps=E5=AE=9A=E4=BD=8D=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectBigScreenController.java | 193 +++++++++++++++++- .../service/ProjectBigScreenService.java | 5 + .../impl/ProjectBigScreenServiceImpl.java | 25 +++ .../controller/GpsEquipmentController.java | 6 +- .../dromara/gps/domain/bo/GpsEquipmentBo.java | 4 + .../gps/mapper/GpsEquipmentSonMapper.java | 20 ++ .../gps/service/IGpsEquipmentService.java | 3 + .../gps/service/IGpsEquipmentSonService.java | 2 + .../service/impl/GpsEquipmentServiceImpl.java | 14 +- .../impl/GpsEquipmentSonServiceImpl.java | 5 + 10 files changed, 266 insertions(+), 11 deletions(-) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/ProjectBigScreenController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/ProjectBigScreenController.java index f13602f7..ddc7f7c7 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/ProjectBigScreenController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/ProjectBigScreenController.java @@ -11,21 +11,27 @@ 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.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.gps.domain.bo.GpsEquipmentBo; +import org.dromara.gps.domain.vo.GpsEquipmentSonVo; +import org.dromara.gps.service.IGpsEquipmentService; import org.dromara.land.domain.BusLandBlock; import org.dromara.land.domain.BusLandTransferLedger; import org.dromara.land.service.IBusLandBlockService; import org.dromara.land.service.IBusLandTransferLedgerService; +import org.dromara.other.domain.OthYs7Device; +import org.dromara.other.service.IOthYs7DeviceService; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectWeatherVo; import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -49,6 +55,10 @@ public class ProjectBigScreenController { private final IBusLandBlockService busLandBlockService; + private final IGpsEquipmentService gpsEquipmentService; + + private final IOthYs7DeviceService othYs7DeviceService; + /** * 查询项目土地统计 */ @@ -167,4 +177,179 @@ public class ProjectBigScreenController { @PathVariable Long projectId) { return R.ok(projectBigScreenService.getProjectGeneralize(projectId)); } + + /** + * 查询设备列表 + */ + @SaCheckPermission("project:bigScreen:getClientList") + @GetMapping("/getClientList/{projectId}") + public R>> getClientList(@NotNull(message = "主键不能为空") + @PathVariable Long projectId) { + List voList = gpsEquipmentService.getClientList(projectId); +// List othYs7DeviceList = othYs7DeviceService.lambdaQuery() +// .eq(OthYs7Device::getProjectId, projectId) +// .list(); + List> maps = new ArrayList<>(); + Map gpsMap = new HashMap<>(); + Map wrjMap = new HashMap<>(); + Map sxtMap = new HashMap<>(); + List> gpsChildrenMap = new ArrayList<>(); +// List> wrjChildrenMap = new ArrayList<>(); +// List> sxtChildrenMap = new ArrayList<>(); + if (voList != null && !voList.isEmpty()) { + for (GpsEquipmentSonVo item : voList) { + Map gps = new HashMap<>(); + gps.put("id", item.getClientId()); + gps.put("label", item.getClientId()); + gps.put("name", item.getDeviceName()); + gps.put("type", "positioningDevice"); + gps.put("lat", item.getLocLatitude()); + gps.put("lng", item.getLocLongitude()); + gps.put("alt", item.getLocAltitude()); + gpsChildrenMap.add(gps); + } + } +// if (othYs7DeviceList != null && !othYs7DeviceList.isEmpty()) { +// for (OthYs7Device item : othYs7DeviceList) { +// Map sxt = new HashMap<>(); +// sxt.put("id", item.getDeviceSerial()); +// sxt.put("label", item.getDeviceSerial()); +// sxt.put("name", item.getDeviceName()); +// sxt.put("type", "shexiangtou"); +//// sxt.put("lat", item.getLocLatitude()); +//// sxt.put("lng", item.getLocLongitude()); +//// sxt.put("alt", item.getLocAltitude()); +// sxtChildrenMap.add(sxt); +// } +// } + List> maps1 = setSxt(); + List> maps2 = setWrj(); + + gpsMap.put("id",1); + gpsMap.put("label","定位设备"); + gpsMap.put("children",gpsChildrenMap); + sxtMap.put("id",2); + sxtMap.put("label","摄像头"); +// sxtMap.put("children",sxtChildrenMap); + sxtMap.put("children",maps1); + wrjMap.put("id",3); + wrjMap.put("label","无人机"); +// wrjMap.put("children",wrjChildrenMap); + wrjMap.put("children",maps2); + + + maps.add(gpsMap); + maps.add(wrjMap); + maps.add(sxtMap); + return R.ok(maps); + } + + + /** + * 查询GPS设备用户列表 + */ + @SaCheckPermission("project:bigScreen:getList") + @GetMapping("/getList") + public R> getList(Long projectId) { + return R.ok(projectBigScreenService.getList(projectId)); + } + + /** + * 新增GPS设备详细 + */ + @SaCheckPermission("project:bigScreen:setList") + @Log(title = "GPS设备详细", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping("/setList") + public void setList(@RequestBody GpsEquipmentBo bo) { + projectBigScreenService.setList(bo); + } + + + + + public List> setSxt(){ + List> sxtChildrenMap = new ArrayList<>(); + HashMap map1 = new HashMap<>(); + map1.put("id", "55"); + map1.put("label", "1222222"); + map1.put("name", "22"); + map1.put("type", "camera"); + map1.put("lng", 106.48349615411811); + map1.put("lat", 29.54856374364732); + map1.put("alt", 0); + HashMap map2 = new HashMap<>(); + map2.put("id", "56"); + map2.put("label", "1222223"); + map2.put("name", "23"); + map2.put("type", "camera"); + map2.put("lng", 106.48442273257676); + map2.put("lat", 29.53841670498476); + map2.put("alt", 0); + HashMap map3 = new HashMap<>(); + map3.put("id", "57"); + map3.put("label", "1222224"); + map3.put("name", "24"); + map3.put("type", "camera"); + map3.put("lng", 106.49197896482423); + map3.put("lat", 29.52931974282576); + map3.put("alt", 0); + HashMap map4 = new HashMap<>(); + map4.put("id", "58"); + map4.put("label", "1222225"); + map4.put("name", "25"); + map4.put("type", "camera"); + map4.put("lng", 106.50293584930655); + map4.put("lat", 29.533025743929034); + map4.put("alt", 0); + + sxtChildrenMap.add(map1); + sxtChildrenMap.add(map2); + sxtChildrenMap.add(map3); + sxtChildrenMap.add(map4); + + return sxtChildrenMap; + } + public List> setWrj(){ + List> sxtChildrenMap = new ArrayList<>(); + HashMap map1 = new HashMap<>(); + map1.put("id", "65"); + map1.put("label", "6222222"); + map1.put("name", "32"); + map1.put("type", "drone"); + map1.put("lng", 106.49556855602525); + map1.put("lat", 29.534393226355515); + map1.put("alt", 0); + HashMap map2 = new HashMap<>(); + map2.put("id", "66"); + map2.put("label", "2222223"); + map2.put("name", "33"); + map2.put("type", "drone"); + map2.put("lng", 106.49142431645038); + map2.put("lat", 29.534472802500083); + map2.put("alt", 0); + HashMap map3 = new HashMap<>(); + map3.put("id", "67"); + map3.put("label", "2222224"); + map3.put("name", "34"); + map3.put("type", "drone"); + map3.put("lng", 106.49142125177437); + map3.put("lat", 29.541881138875755); + map3.put("alt", 0); + HashMap map4 = new HashMap<>(); + map4.put("id", "68"); + map4.put("label", "2222225"); + map4.put("name", "35"); + map4.put("type", "drone"); + map4.put("lng", 106.50256649933792); + map4.put("lat", 29.54260793685717); + map4.put("alt", 0); + + sxtChildrenMap.add(map1); + sxtChildrenMap.add(map2); + sxtChildrenMap.add(map3); + sxtChildrenMap.add(map4); + + return sxtChildrenMap; + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/ProjectBigScreenService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/ProjectBigScreenService.java index a783281e..06074a6e 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/ProjectBigScreenService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/ProjectBigScreenService.java @@ -3,6 +3,7 @@ package org.dromara.bigscreen.service; import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo; import org.dromara.bigscreen.domain.vo.ProjectPeopleVo; import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo; +import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo; import org.dromara.project.domain.vo.project.BusProjectWeatherVo; import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo; @@ -70,4 +71,8 @@ public interface ProjectBigScreenService { * @return 项目概括 */ String getProjectGeneralize(Long projectId); + + List getList(Long projectId); + + void setList(GpsEquipmentBo bo); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/ProjectBigScreenServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/ProjectBigScreenServiceImpl.java index 56664199..7fd05da8 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/ProjectBigScreenServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/ProjectBigScreenServiceImpl.java @@ -1,6 +1,8 @@ package org.dromara.bigscreen.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import jakarta.annotation.Resource; import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo; import org.dromara.bigscreen.domain.vo.ProjectPeopleVo; @@ -9,9 +11,11 @@ import org.dromara.bigscreen.domain.vo.ProjectTeamAttendanceVo; import org.dromara.bigscreen.service.ProjectBigScreenService; import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.redis.utils.RedisUtils; import org.dromara.common.utils.BigDecimalUtil; import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.service.ISubConstructionUserService; +import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum; import org.dromara.progress.service.IPgsProgressCategoryService; @@ -359,4 +363,25 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService { } } + @Override + public List getList(Long projectId) { + if (projectId == null){ + throw new ServiceException("项目id不能为空!!!"); + } + Object object = RedisUtils.getCacheObject("xmjdp:" + projectId); + if (object == null) { + return null; + } + JSONArray objects = JSONUtil.parseArray(object); + return objects.toList(String.class); + + } + + @Override + public void setList(GpsEquipmentBo bo) { + if (bo.getProjectId() == null){ + throw new ServiceException("项目id不能为空!!!"); + } + RedisUtils.setCacheObject("xmjdp:"+bo.getProjectId(), bo.getIdList()); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/controller/GpsEquipmentController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/controller/GpsEquipmentController.java index 46aad0af..5d2728d4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/controller/GpsEquipmentController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/controller/GpsEquipmentController.java @@ -1,6 +1,7 @@ package org.dromara.gps.controller; import java.util.List; +import java.util.Map; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -16,9 +17,7 @@ import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQue import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo; import org.dromara.contractor.service.ISubConstructionUserService; -import org.dromara.gps.domain.vo.ConstructionUser; -import org.dromara.gps.domain.vo.GpsProjectVo; -import org.dromara.gps.domain.vo.GpsUserVo; +import org.dromara.gps.domain.vo.*; import org.dromara.project.service.IBusProjectService; import org.dromara.system.domain.SysUser; import org.dromara.system.domain.vo.SysUserVo; @@ -33,7 +32,6 @@ import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.EditGroup; import org.dromara.common.log.enums.BusinessType; import org.dromara.common.excel.utils.ExcelUtil; -import org.dromara.gps.domain.vo.GpsEquipmentVo; import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.gps.service.IGpsEquipmentService; import org.dromara.common.mybatis.core.page.TableDataInfo; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/domain/bo/GpsEquipmentBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/domain/bo/GpsEquipmentBo.java index 2b79f0b9..8dfffb3a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/domain/bo/GpsEquipmentBo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/domain/bo/GpsEquipmentBo.java @@ -9,6 +9,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import java.util.List; + /** * GPS设备详细业务对象 gps_equipment * @@ -78,4 +80,6 @@ public class GpsEquipmentBo extends BaseEntity { private Integer type; + private List idList; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/mapper/GpsEquipmentSonMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/mapper/GpsEquipmentSonMapper.java index 9222c824..c90952d9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/mapper/GpsEquipmentSonMapper.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/mapper/GpsEquipmentSonMapper.java @@ -1,9 +1,13 @@ package org.dromara.gps.mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.dromara.gps.domain.GpsEquipmentSon; import org.dromara.gps.domain.vo.GpsEquipmentSonVo; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import java.util.List; + /** * GPS设备定位信息Mapper接口 * @@ -12,4 +16,20 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; */ public interface GpsEquipmentSonMapper extends BaseMapperPlus { + @Select("WITH RankedData AS (\n" + + " SELECT\n" + + " *,\n" + + " ROW_NUMBER() OVER (PARTITION BY client_id ORDER BY create_time DESC) AS rn\n" + + " FROM\n" + + " gps_equipment_son \n" + + "WHERE \n" + + "project_id = #{projectId}\n" + + ")\n" + + "SELECT\n" + + " *\n" + + "FROM\n" + + " RankedData\n" + + "WHERE\n" + + " rn = 1;") + List getClientList(@Param("projectId") Long projectId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentService.java index 2ae03828..6e19d0a6 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentService.java @@ -1,5 +1,6 @@ package org.dromara.gps.service; +import org.dromara.gps.domain.vo.GpsEquipmentSonVo; import org.dromara.gps.domain.vo.GpsEquipmentVo; import org.dromara.gps.domain.bo.GpsEquipmentBo; import org.dromara.gps.domain.GpsEquipment; @@ -94,4 +95,6 @@ public interface IGpsEquipmentService extends IService{ List getUserList(GpsEquipmentBo bo); List getProjectList(); + + List getClientList(Long projectId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentSonService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentSonService.java index 91bd9bd9..511c45b4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentSonService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/IGpsEquipmentSonService.java @@ -67,4 +67,6 @@ public interface IGpsEquipmentSonService extends IService{ * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + List getClientList(Long projectId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentServiceImpl.java index 3a0b0504..a160f916 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentServiceImpl.java @@ -1,6 +1,7 @@ package org.dromara.gps.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -20,6 +21,7 @@ import org.dromara.common.websocket.dto.WebSocketMessageDto; import org.dromara.common.websocket.utils.WebSocketUtils; import org.dromara.gps.domain.GpsManmachine; import org.dromara.gps.domain.bo.GpsEquipmentSonBo; +import org.dromara.gps.domain.vo.GpsEquipmentSonVo; import org.dromara.gps.domain.vo.GpsProjectVo; import org.dromara.gps.domain.vo.GpsUserVo; import org.dromara.gps.mapper.GpsManmachineMapper; @@ -44,7 +46,6 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.Duration; import java.util.*; -import java.util.stream.Collectors; /** * GPS设备详细Service业务层处理 @@ -246,11 +247,11 @@ public class GpsEquipmentServiceImpl extends ServiceImpl getClientList(Long projectId) { + return gpsEquipmentSonService.getClientList(projectId); + } + + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentSonServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentSonServiceImpl.java index f997abff..71e9b25c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentSonServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/gps/service/impl/GpsEquipmentSonServiceImpl.java @@ -130,4 +130,9 @@ public class GpsEquipmentSonServiceImpl extends ServiceImpl 0; } + + @Override + public List getClientList(Long projectId) { + return baseMapper.getClientList(projectId); + } }