Browse Source

Merge branch 'master' of 123.57.213.14:guoqiang.duan/zgzt-sys-java

qiangxuan 7 months ago
parent
commit
29a6b75549

+ 0 - 16
jeecg-module-gather/src/main/java/org/jeecg/modules/device/controller/DeviceInformationController.java

@@ -303,20 +303,4 @@ public class DeviceInformationController extends JeecgController<DeviceInformati
 		}
 		return Result.OK("文件导入失败!");
     }
-
-
-	 /**
-	  * 通过区域划分获取设备
-	  *
-	  * @return
-	  */
-	 @GetMapping(value = "/getByRegion")
-	 public Result<List<DeviceInformation>> getByRegion(@RequestParam(name = "region") String region,@RequestParam(name = "region") String type) {
-		 LambdaQueryWrapper<DeviceInformation> eq = new LambdaQueryWrapper<DeviceInformation>()
-				 .eq(DeviceInformation::getDeviceRegionId, region)
-				 .isNull(DeviceInformation::getFreq)
-				 .eq(DeviceInformation::getDeviceGather,type);
-		 return Result.OK(deviceInformationService.list(eq));
-	 }
-
 }

+ 0 - 153
jeecg-module-gather/src/main/java/org/jeecg/modules/device/controller/GatherManageController.java

@@ -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("连接失败!");
-    }
-}

+ 3 - 3
jeecg-module-gather/src/main/java/org/jeecg/modules/device/entity/DeviceGatherService.java

@@ -33,8 +33,8 @@ public class DeviceGatherService implements Serializable {
     @ApiModelProperty(value = "主键")
     private String id;
 	/**设备类型*/
-	@Excel(name = "设备类型", width = 15, dicCode = "equipment_model")
-    @ApiModelProperty(value = "设备类型")
+	@Excel(name = "采集设备类型", width = 15, dicCode = "equipment_model")
+    @ApiModelProperty(value = "采集设备类型")
     @Dict(dicCode = "equipment_model")
     private String s7Model;
 	/**ip*/
@@ -137,7 +137,7 @@ public class DeviceGatherService implements Serializable {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String freq;
     /**设备名称*/
-    @Excel(name = "设备名称", width = 15)
+    @Excel(name = "采集设备名称", width = 15)
     @ApiModelProperty(value = "设备名称")
     private String deviceTitle;
 }

+ 0 - 22
jeecg-module-gather/src/main/java/org/jeecg/modules/device/entity/GatherManageAddBatchParam.java

@@ -1,22 +0,0 @@
-package org.jeecg.modules.device.entity;
-
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.util.List;
-
-@Data
-@Accessors(chain = true)
-@EqualsAndHashCode(callSuper = false)
-@ApiModel(value="采集管理-批量新增参数", description="采集管理-批量新增参数")
-public class GatherManageAddBatchParam {
-
-    @ApiModelProperty(value = "新增采集设备集")
-    private List<DeviceInformation> deviceInformations;
-
-
-}

+ 0 - 24
jeecg-module-gather/src/main/java/org/jeecg/modules/device/entity/GatherManageAddParam.java

@@ -1,24 +0,0 @@
-package org.jeecg.modules.device.entity;
-
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-@Data
-@Accessors(chain = true)
-@EqualsAndHashCode(callSuper = false)
-@ApiModel(value="采集管理-新增参数", description="采集管理-新增参数")
-public class GatherManageAddParam {
-
-    @ApiModelProperty(value = "设备id")
-    private String deviceId;
-
-    @ApiModelProperty(value = "频率")
-    private String freq;
-
-
-}

+ 0 - 10
jeecg-module-gather/src/main/java/org/jeecg/modules/device/service/IGatherManageService.java

@@ -1,10 +0,0 @@
-package org.jeecg.modules.device.service;
-
-import org.jeecg.common.api.vo.Result;
-import org.springframework.web.bind.annotation.RequestBody;
-
-public interface IGatherManageService {
-
-    boolean testConn(String id);
-
-}

+ 0 - 55
jeecg-module-gather/src/main/java/org/jeecg/modules/device/service/impl/GatherManageServiceImpl.java

@@ -1,55 +0,0 @@
-package org.jeecg.modules.device.service.impl;
-
-import lombok.extern.slf4j.Slf4j;
-import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
-import org.jeecg.modules.device.entity.DeviceGatherService;
-import org.jeecg.modules.device.entity.DeviceInformation;
-import org.jeecg.modules.device.service.IDeviceGatherServiceService;
-import org.jeecg.modules.device.service.IDeviceInformationService;
-import org.jeecg.modules.device.service.IGatherManageService;
-import org.jeecg.modules.deviceConn.modbus.service.ModbusTcp;
-import org.jeecg.modules.deviceConn.opc.utils.OpcUaServerUtils;
-import org.jeecg.modules.deviceConn.s7.service.S7PLC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-@Slf4j
-public class GatherManageServiceImpl implements IGatherManageService {
-
-    @Autowired
-    IDeviceGatherServiceService deviceGatherServiceService;
-
-    @Override
-    public boolean testConn(String id) {
-        boolean mark = false;
-        DeviceGatherService deviceGatherService = deviceGatherServiceService.getById(id);
-        if(deviceGatherService.getDeviceGather().equals("s7")){
-            S7PLC s7PLC = new S7PLC(deviceGatherService.getS7Model(), deviceGatherService.getDeviceIp(), Integer.valueOf(deviceGatherService.getDevicePort()), deviceGatherService.getS7Rack(), Integer.valueOf(deviceGatherService.getS7Slot()), Integer.valueOf(deviceGatherService.getS7LongestWidth()));
-            String read = "";
-            read = "" + s7PLC.readInt16("DB2.1");
-            s7PLC.close();
-            mark = true;
-        }else if(deviceGatherService.getDeviceGather().equals("opc")){
-            OpcUaClient opcUaClient = null;
-            try {
-                opcUaClient = OpcUaServerUtils.connectOpcUaServer(deviceGatherService);
-                mark = true;
-            } catch (Exception e) {
-                log.error(e.getMessage());
-            }finally {
-                if(opcUaClient!=null)opcUaClient.disconnect();
-            }
-        }else if(deviceGatherService.getDeviceGather().equals("modbus")){
-//            ModbusTcp plc = new ModbusTcp(deviceInformation.getMobusDeviceNum(), deviceInformation.getDeviceIp(), Integer.valueOf(deviceInformation.getDevicePort()));
-//            String read = "";
-//            read = "" + plc.readInt16(100);
-//            // 需要手动关闭
-//            plc.close();
-            mark = true;
-        }
-        return mark;
-    }
-
-
-}