Browse Source

采集服务

guoqiang 7 months ago
parent
commit
0b2876c0e4

+ 1 - 1
jeecg-module-conn/src/main/java/org/jeecg/modules/watch/MqttGatherWatch.java

@@ -19,7 +19,7 @@ import java.util.List;
 @Slf4j
 @EnableAsync
 @Component
-@EnableScheduling
+//@EnableScheduling
 public class MqttGatherWatch {
 
     @Autowired

+ 141 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/controller/DeviceGatherServiceController.java

@@ -0,0 +1,141 @@
+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.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.device.entity.DeviceGatherService;
+import org.jeecg.modules.device.service.IDeviceGatherServiceService;
+import org.jeecg.modules.watch.s7gatherWatch;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+* @Description: 设备采集服务表
+* @Author: jeecg-boot
+* @Date:   2024-09-19
+* @Version: V1.0
+*/
+@Api(tags="设备采集服务表")
+@RestController
+@RequestMapping("/device/deviceGatherService")
+@Slf4j
+public class DeviceGatherServiceController extends JeecgController<DeviceGatherService, IDeviceGatherServiceService> {
+   @Autowired
+   private IDeviceGatherServiceService deviceGatherServiceService;
+
+   @Autowired
+   private s7gatherWatch s7gatherWatch;
+
+   /**
+    * 分页列表查询
+    *
+    * @param deviceGatherService
+    * @param pageNo
+    * @param pageSize
+    * @param req
+    * @return
+    */
+   //@AutoLog(value = "设备管理信息表-分页列表查询")
+   @ApiOperation(value="设备采集服务表-分页列表查询", notes="设备采集服务表-分页列表查询")
+   @GetMapping(value = "/list")
+   public Result<IPage<DeviceGatherService>> queryPageList(DeviceGatherService deviceGatherService,
+                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                  HttpServletRequest req) {
+       QueryWrapper<DeviceGatherService> queryWrapper = QueryGenerator.initQueryWrapper(deviceGatherService, req.getParameterMap());
+       Page<DeviceGatherService> page = new Page<DeviceGatherService>(pageNo, pageSize);
+       IPage<DeviceGatherService> pageList = deviceGatherServiceService.page(page, queryWrapper);
+       return Result.OK(pageList);
+   }
+
+   /**
+    *   添加
+    *
+    * @param deviceGatherService
+    * @return
+    */
+   @AutoLog(value = "设备采集服务表-添加")
+   @ApiOperation(value="设备采集服务表-添加", notes="设备采集服务表-添加")
+   @PostMapping(value = "/add")
+   public Result<String> add(@RequestBody DeviceGatherService deviceGatherService) {
+       deviceGatherServiceService.save(deviceGatherService);
+       return Result.OK("添加成功!");
+   }
+
+   /**
+    *  编辑
+    *
+    * @param deviceGatherService
+    * @return
+    */
+   @AutoLog(value = "设备采集服务表-编辑")
+   @ApiOperation(value="设备采集服务表-编辑", notes="设备采集服务表-编辑")
+   @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+   public Result<String> edit(@RequestBody DeviceGatherService deviceGatherService) {
+       deviceGatherServiceService.updateById(deviceGatherService);
+       s7gatherWatch.closeS7(deviceGatherService.getId());
+       return Result.OK("编辑成功!");
+   }
+
+   /**
+    *   通过id删除
+    *
+    * @param id
+    * @return
+    */
+   @AutoLog(value = "设备采集服务表-通过id删除")
+   @ApiOperation(value="设备采集服务表-通过id删除", notes="设备采集服务表-通过id删除")
+//	@RequiresPermissions("device:device_information:delete")
+   @DeleteMapping(value = "/delete")
+   public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+       deviceGatherServiceService.removeById(id);
+       s7gatherWatch.closeS7(id);
+       return Result.OK("删除成功!");
+   }
+
+   /**
+    *  批量删除
+    *
+    * @param ids
+    * @return
+    */
+   @AutoLog(value = "设备采集服务表-批量删除")
+   @ApiOperation(value="设备采集服务表-批量删除", notes="设备采集服务表-批量删除")
+//	@RequiresPermissions("device:device_information:deleteBatch")
+   @DeleteMapping(value = "/deleteBatch")
+   public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+       this.deviceGatherServiceService.removeByIds(Arrays.asList(ids.split(",")));
+       Arrays.asList(ids.split(",")).forEach(id->{
+           s7gatherWatch.closeS7(id);
+       });
+       return Result.OK("批量删除成功!");
+   }
+
+   /**
+    * 通过id查询
+    *
+    * @param id
+    * @return
+    */
+   //@AutoLog(value = "设备管理信息表-通过id查询")
+   @ApiOperation(value="设备采集服务表-通过id查询", notes="设备采集服务表-通过id查询")
+   @GetMapping(value = "/queryById")
+   public Result<DeviceGatherService> queryById(@RequestParam(name="id",required=true) String id) {
+       DeviceGatherService deviceGatherService = deviceGatherServiceService.getById(id);
+       if(deviceGatherService==null) {
+           return Result.error("未找到对应数据");
+       }
+       return Result.OK(deviceGatherService);
+   }
+
+}

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

@@ -0,0 +1,139 @@
+package org.jeecg.modules.device.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 设备管理信息表
+ * @Author: jeecg-boot
+ * @Date:   2024-09-19
+ * @Version: V1.0
+ */
+@Data
+@TableName("device_gather_service")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="device_gather_service对象", description="设备采集服务表")
+public class DeviceGatherService implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+	/**设备类型*/
+	@Excel(name = "设备类型", width = 15, dicCode = "equipment_model")
+    @ApiModelProperty(value = "设备类型")
+    @Dict(dicCode = "equipment_model")
+    private String s7Model;
+	/**ip*/
+	@Excel(name = "ip", width = 15)
+    @ApiModelProperty(value = "ip")
+    private String deviceIp;
+	/**端口*/
+	@Excel(name = "端口", width = 15)
+    @ApiModelProperty(value = "端口")
+    private String devicePort;
+	/**机架号*/
+	@Excel(name = "机架号", width = 15)
+    @ApiModelProperty(value = "机架号")
+    private Integer s7Rack;
+	/**槽号*/
+	@Excel(name = "槽号", width = 15)
+    @ApiModelProperty(value = "槽号")
+    private String s7Slot;
+	/**安装地址*/
+	@Excel(name = "安装地址", width = 15)
+    @ApiModelProperty(value = "安装地址")
+    private String deviceAddress;
+	/**最长位宽*/
+	@Excel(name = "最长位宽", width = 15)
+    @ApiModelProperty(value = "最长位宽")
+    private String s7LongestWidth;
+	/**备注*/
+	@Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private String deviceRemark;
+	/**采集通道*/
+	@Excel(name = "采集通道", width = 15, dicCode = "device_information_gather")
+    @ApiModelProperty(value = "采集通道")
+    @Dict(dicCode = "device_information_gather")
+    private String deviceGather;
+	/**从站号*/
+	@Excel(name = "从站号", width = 15)
+    @ApiModelProperty(value = "从站号")
+    private Integer modbusDeviceNum;
+	/**运行状态*/
+	@Excel(name = "运行状态", width = 15, dicCode = "sfqy")
+    @ApiModelProperty(value = "运行状态")
+    @Dict(dicCode = "sfqy")
+    private String status;
+	/**所在部门*/
+    @ApiModelProperty(value = "所在部门")
+    private String sysOrgCode;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**创建日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+	/**更新日期*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新日期")
+    private Date updateTime;
+	/**clsid*/
+	@Excel(name = "clsid", width = 15)
+    @ApiModelProperty(value = "clsid")
+    private String opcClsid;
+	/**用户名*/
+	@Excel(name = "用户名", width = 15)
+    @ApiModelProperty(value = "用户名")
+    private String opcUsername;
+	/**密码*/
+	@Excel(name = "密码", width = 15)
+    @ApiModelProperty(value = "密码")
+    private String opcPassword;
+	/**注册表中的名称*/
+	@Excel(name = "注册表中的名称", width = 15)
+    @ApiModelProperty(value = "注册表中的名称")
+    private String opcRegname;
+	/**opc版本号*/
+	@Excel(name = "opc版本号", width = 15)
+    @ApiModelProperty(value = "opc版本号")
+    private String opcVersion;
+	/**opc中文名称*/
+	@Excel(name = "opc中文名称", width = 15)
+    @ApiModelProperty(value = "opc中文名称")
+    private String opcZhName;
+	/**opc英文名称*/
+	@Excel(name = "opc英文名称", width = 15)
+    @ApiModelProperty(value = "opc英文名称")
+    private String opcEnName;
+    /**opc域*/
+    @Excel(name = "opc域", width = 15)
+    @ApiModelProperty(value = "opc域")
+    private String opcDomain;
+    /**采集频率*/
+    @Excel(name = "采集频率", width = 15)
+    @ApiModelProperty(value = "采集频率")
+    @Dict(dicCode = "device_freq")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String freq;
+}

+ 14 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/mapper/DeviceGatherServiceMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.device.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.device.entity.DeviceGatherService;
+
+/**
+ * @Description: 设备采集服务表
+ * @Author: jeecg-boot
+ * @Date:   2024-09-19
+ * @Version: V1.0
+ */
+public interface DeviceGatherServiceMapper extends BaseMapper<DeviceGatherService> {
+
+}

+ 5 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/mapper/xml/DeviceGatherServiceMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.device.mapper.DeviceGatherServiceMapper">
+
+</mapper>

+ 14 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/service/IDeviceGatherServiceService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.device.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.device.entity.DeviceGatherService;
+
+/**
+ * @Description: 设备采集服务表
+ * @Author: jeecg-boot
+ * @Date:   2024-09-19
+ * @Version: V1.0
+ */
+public interface IDeviceGatherServiceService extends IService<DeviceGatherService> {
+
+}

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

@@ -0,0 +1,18 @@
+package org.jeecg.modules.device.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.device.entity.DeviceGatherService;
+import org.jeecg.modules.device.mapper.DeviceGatherServiceMapper;
+import org.jeecg.modules.device.service.IDeviceGatherServiceService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: 设备采集服务表
+ * @Author: jeecg-boot
+ * @Date:   2024-09-19
+ * @Version: V1.0
+ */
+@Service
+public class DeviceGatherServiceServiceImpl extends ServiceImpl<DeviceGatherServiceMapper, DeviceGatherService> implements IDeviceGatherServiceService {
+
+}

+ 1 - 1
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8080
+  port: 8181
   tomcat:
     max-swallow-size: -1
   error: