吉安感知网项目-后端
linwei
2026-06-23 ebeb43ea497fafc448c827d1de6796bcaa4e0b52
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/controller/GdManageDeviceController.java
@@ -32,12 +32,14 @@
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import org.sxkj.gd.common.GenericConverter;
import org.sxkj.gd.common.IdParam;
import org.sxkj.gd.workorder.dto.GdManageDeviceDTO;
import org.sxkj.gd.workorder.entity.GdManageDeviceEntity;
import org.sxkj.gd.workorder.excel.GdManageDeviceExcel;
import org.sxkj.gd.workorder.param.GdManageDevicePageParam;
import org.sxkj.gd.workorder.service.IGdManageDeviceService;
import org.sxkj.gd.workorder.vo.GdManageDeviceVO;
import org.sxkj.gd.workorder.wrapper.GdManageDeviceWrapper;
@@ -82,7 +84,7 @@
   @GetMapping("/list")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "不分页", notes = "传入gdManageDevice")
   public R<List<GdManageDeviceVO>> page(GdManageDeviceVO gdManageDevice) {
   public R<List<GdManageDeviceVO>> page(GdManageDevicePageParam gdManageDevice) {
      List<GdManageDeviceVO> pages = gdManageDeviceService.selectGdManageDevice(gdManageDevice);
      return R.data(pages);
   }
@@ -93,18 +95,32 @@
   @GetMapping("/page")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入gdManageDevice")
   public R<IPage<GdManageDeviceVO>> page(GdManageDeviceVO gdManageDevice, Query query) {
   public R<IPage<GdManageDeviceVO>> page(GdManageDevicePageParam gdManageDevice, Query query) {
      IPage<GdManageDeviceVO> pages = gdManageDeviceService.selectGdManageDevicePage(Condition.getPage(query), gdManageDevice);
      return R.data(pages);
   }
   /**
    * 设备信息 新增或修改
    * 设备信息 新增或修改(对外)
    */
   @PostMapping("/submit")
   @PostMapping("/submitExternal")
   @ApiOperationSupport(order = 6)
   @ApiOperation(value = "新增或修改", notes = "传入gdManageDevice")
   public R submit(@Valid @RequestBody GdManageDeviceDTO gdManageDevice) throws Exception {
   @ApiOperation(value = "新增或修改", notes = "传入gdManageDevice,设备编码相同则修改")
   public R submitExternal(@Valid @RequestBody GdManageDeviceDTO gdManageDevice) throws Exception {
      if (StringUtil.isBlank(gdManageDevice.getDeviceSn())) {
         return R.fail("设备编码不能为空");
      }
      QueryWrapper<GdManageDeviceEntity> queryWrapper = new QueryWrapper<>();
      queryWrapper.lambda().eq(GdManageDeviceEntity::getDeviceSn, gdManageDevice.getDeviceSn());
      GdManageDeviceEntity detail = gdManageDeviceService.getOne(queryWrapper);
      if (detail != null) {
         gdManageDevice.setId(detail.getId());
      }
      return R.status(gdManageDeviceService.saveOrUpdateDevice(GdManageDeviceWrapper.build().entityDTO(gdManageDevice)));
   }
@@ -118,6 +134,17 @@
      return R.status(gdManageDeviceService.deleteLogic(Func.toLongList(ids)));
   }
   /**
    * 同步星图设备(测试接口)
    */
   @PostMapping("/sync-xingtu")
   @ApiOperationSupport(order = 8)
   @ApiOperation(value = "同步星图设备(测试)", notes = "同步无人机和机巢到设备表")
   public R syncXingtuDevice() throws Exception {
      int count = gdManageDeviceService.syncXingtuDevice();
      return R.data(count);
   }
   /**
    * 导出数据