|
@@ -1,153 +0,0 @@
|
|
|
-package org.jeecg.modules.device.controller;
|
|
|
-
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.jeecg.common.api.vo.Result;
|
|
|
-import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
-import org.jeecg.common.system.query.QueryGenerator;
|
|
|
-import org.jeecg.modules.device.entity.DeviceInformation;
|
|
|
-import org.jeecg.modules.device.entity.GatherManageAddBatchParam;
|
|
|
-import org.jeecg.modules.device.entity.GatherManageAddParam;
|
|
|
-import org.jeecg.modules.device.service.IDeviceGatherServiceService;
|
|
|
-import org.jeecg.modules.device.service.IDeviceInformationService;
|
|
|
-import org.jeecg.modules.device.service.IGatherManageService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description: 采集管理
|
|
|
- * @Author: jeecg-boot
|
|
|
- * @Date: 2024-09-19
|
|
|
- * @Version: V1.0
|
|
|
- */
|
|
|
-@Api(tags="采集管理")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/device/gatherManage")
|
|
|
-@Slf4j
|
|
|
-public class GatherManageController {
|
|
|
-
|
|
|
-// @Autowired
|
|
|
-// private IDeviceInformationService deviceInformationService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IGatherManageService gatherManageService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IDeviceGatherServiceService deviceGatherServiceService;
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param deviceInformation
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "设备管理信息表-分页列表查询")
|
|
|
- @ApiOperation(value="采集管理-分页列表查询", notes="采集管理-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<DeviceInformation>> queryPageList(DeviceInformation deviceInformation,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- QueryWrapper<DeviceInformation> queryWrapper = QueryGenerator.initQueryWrapper(deviceInformation, req.getParameterMap());
|
|
|
- queryWrapper.isNotNull("freq");
|
|
|
- Page<DeviceInformation> page = new Page<DeviceInformation>(pageNo, pageSize);
|
|
|
- IPage<DeviceInformation> pageList = deviceInformationService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 未配置采集频率设备分页列表查询
|
|
|
- *
|
|
|
- * @param deviceInformation
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "设备管理信息表-分页列表查询")
|
|
|
- @ApiOperation(value="未配置采集频率设备分页列表查询", notes="未配置采集频率设备分页列表查询")
|
|
|
- @GetMapping(value = "/notAddlist")
|
|
|
- public Result<IPage<DeviceInformation>> queryNotAddPageList(DeviceInformation deviceInformation,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- QueryWrapper<DeviceInformation> queryWrapper = QueryGenerator.initQueryWrapper(deviceInformation, req.getParameterMap());
|
|
|
- queryWrapper.isNull("freq");
|
|
|
- Page<DeviceInformation> page = new Page<DeviceInformation>(pageNo, pageSize);
|
|
|
- IPage<DeviceInformation> pageList = deviceInformationService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增
|
|
|
- *
|
|
|
- * @param gatherManageAddParam
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "采集管理-新增或编辑")
|
|
|
- @ApiOperation(value="采集管理-新增或编辑", notes="采集管理-新增或编辑")
|
|
|
- @PostMapping(value = "/addOrEdit")
|
|
|
- public Result<String> addOrEdit(@RequestBody GatherManageAddParam gatherManageAddParam) {
|
|
|
- DeviceInformation deviceInformation = deviceInformationService.getById(gatherManageAddParam.getDeviceId());
|
|
|
- deviceInformation.setFreq(gatherManageAddParam.getFreq());
|
|
|
- deviceInformationService.updateById(deviceInformation);
|
|
|
- return Result.OK("操作成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量新增
|
|
|
- *
|
|
|
- * @param gatherManageAddBatchParam
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "采集管理-批量新增")
|
|
|
- @ApiOperation(value="采集管理-批量新增", notes="采集管理-批量新增")
|
|
|
- @PostMapping(value = "/addBatch")
|
|
|
- public Result<String> addBatch(@RequestBody GatherManageAddBatchParam gatherManageAddBatchParam) {
|
|
|
- deviceInformationService.updateBatchById(gatherManageAddBatchParam.getDeviceInformations());
|
|
|
- return Result.OK("批量新增成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量新增
|
|
|
- *
|
|
|
- * @param deviceInformation
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "采集管理-删除")
|
|
|
- @ApiOperation(value="采集管理-删除", notes="采集管理-删除")
|
|
|
- @PostMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestBody DeviceInformation deviceInformation) {
|
|
|
- deviceInformation.setFreq(null);
|
|
|
- deviceInformationService.updateById(deviceInformation);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 连接测试
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "采集管理-连接测试")
|
|
|
- @ApiOperation(value="采集管理-连接测试", notes="采集管理-连接测试")
|
|
|
- @PostMapping(value = "/testConn")
|
|
|
- public Result<String> testConn(String id) {
|
|
|
- boolean mark = gatherManageService.testConn(id);
|
|
|
- if(mark){
|
|
|
- return Result.OK("连接成功");
|
|
|
- }
|
|
|
- return Result.error("连接失败!");
|
|
|
- }
|
|
|
-}
|