|
@@ -40,8 +40,7 @@ public class DeviceController {
|
|
|
|
|
|
@Autowired
|
|
|
private DeviceService deviceService;
|
|
|
- @Autowired
|
|
|
- private CareDeviceService careDeviceService;
|
|
|
+
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
@ApiOperation(value = "设备列表分页--二期修改")
|
|
@@ -132,48 +131,5 @@ public class DeviceController {
|
|
|
return Result.error("删除失败!");
|
|
|
}
|
|
|
}
|
|
|
- @GetMapping("/listDeviceNonStation")
|
|
|
- @ApiOperation(value = "查询站点为空的设备列表分页--四期期新增")
|
|
|
- public PageResult<List<DeviceVO>> listDeviceNonStation(HttpServletRequest request, @RequestHeader(value = "token") String token,
|
|
|
- PageReqVO pageReqVo){
|
|
|
- try {
|
|
|
- UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
- IPage<DeviceVO> pageResponse = this.deviceService.listDeviceNonStation(loginUser ,pageReqVo);
|
|
|
- return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
|
|
|
- }catch (BDException e) {
|
|
|
- log.error("设备列表查询-分页列表出现异常",e);
|
|
|
- return PageResult.error(e.getMessage());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("设备管理: 设备列表查询出现异常",e);
|
|
|
- return PageResult.error( "获取列表失败");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/distributeDevice")
|
|
|
- @ApiOperation(value = "分配设备(对象list中只设置stationId和设备的id) --四期新增 ")
|
|
|
- public Result<Object> distributeDevice( @RequestHeader("token") String token,
|
|
|
- @RequestBody List<DeviceVO> vos) {
|
|
|
- try {
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(vos)) {
|
|
|
- return Result.error("分配设备列表不能为空!");
|
|
|
- }
|
|
|
- List<CareDevice> careDevices = new ArrayList<>();
|
|
|
- for (DeviceVO vo : vos) {
|
|
|
- CareDevice careDevice = new CareDevice();
|
|
|
- BeanUtil.copyProperties(vo, careDevice);
|
|
|
- careDevices.add(careDevice);
|
|
|
- }
|
|
|
|
|
|
- this.careDeviceService.updateBatchById(careDevices);
|
|
|
-
|
|
|
- return Result.success("分配设备成功!");
|
|
|
- } catch (BDException e) {
|
|
|
- log.error("分配设备-出现异常", e);
|
|
|
- return Result.error(e.getMessage());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("设备管理: 分配设备出现异常", e);
|
|
|
- return Result.error("分配设备失败!");
|
|
|
- }
|
|
|
- }
|
|
|
}
|