瀏覽代碼

添加设备日志及设备列表

zhifei 1 年之前
父節點
當前提交
434deae870

+ 1 - 1
warewms-admin/src/main/resources/application-dev.yml

@@ -174,7 +174,7 @@ mybatis-plus:
     dbConfig:
       # 主键类型
       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
-      idType: AUTO
+      idType: ASSIGN_ID
       logic-delete-field: deleted # 全局逻辑删除的实体字段名
       logic-delete-value: 1 # 逻辑已删除值(默认为 1)
       logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)

+ 1 - 1
warewms-admin/src/main/resources/application-prod.yml

@@ -174,7 +174,7 @@ mybatis-plus:
     dbConfig:
       # 主键类型
       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
-      idType: AUTO
+      idType: ASSIGN_ID
       logic-delete-field: deleted # 全局逻辑删除的实体字段名
       logic-delete-value: 1 # 逻辑已删除值(默认为 1)
       logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/InkjetPrintersConnect.java

@@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 @Slf4j
 public class InkjetPrintersConnect implements TCPConnectBase {
 
-    private final String IP_ADDR = "127.0.0.1";
+    private final String IP_ADDR = "172.20.27.4";
 
     private final int PORT = 9999;
 

+ 32 - 0
warewms-system/src/main/java/com/warewms/hailiang/contoller/DeviceController.java

@@ -0,0 +1,32 @@
+package com.warewms.hailiang.contoller;
+
+import com.warewms.common.core.domain.base.page.PageDomain;
+import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.hailiang.domian.Device;
+import com.warewms.hailiang.domian.DeviceLog;
+import com.warewms.hailiang.service.DeviceLogService;
+import com.warewms.hailiang.service.DeviceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author AD
+ * @description 针对表【device_log(设备日志表)】的数据库操作Controller
+ * @createDate 2023-08-21 13:24:57
+ */
+@RestController
+@RequestMapping("/device")
+public class DeviceController {
+
+    @Autowired
+    DeviceService deviceService;
+
+    @GetMapping("/list")
+    public List<Device> getList(){
+       return deviceService.getList();
+    }
+}

+ 28 - 0
warewms-system/src/main/java/com/warewms/hailiang/contoller/DeviceLogController.java

@@ -0,0 +1,28 @@
+package com.warewms.hailiang.contoller;
+
+import com.warewms.common.core.domain.base.page.PageDomain;
+import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.hailiang.domian.DeviceLog;
+import com.warewms.hailiang.service.DeviceLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author AD
+ * @description 针对表【device_log(设备日志表)】的数据库操作Controller
+ * @createDate 2023-08-21 13:24:57
+ */
+@RestController
+@RequestMapping("/device/log")
+public class DeviceLogController {
+
+    @Autowired
+    DeviceLogService deviceLogService;
+
+    @GetMapping("/list")
+    public TableDataInfo<DeviceLog> getList(DeviceLog deviceLog, PageDomain pageDomain){
+       return deviceLogService.getList(deviceLog,pageDomain);
+    }
+}

+ 11 - 2
warewms-system/src/main/java/com/warewms/hailiang/enums/WeighPlcEnum.java

@@ -10,11 +10,20 @@ import lombok.Data;
  * Description:称重plc对接枚举
  **/
 public enum WeighPlcEnum {
+    /**
+     * 是否可以读取重量
+     */
+    IsRead(""),
+
+    /**
+     * 读取重量
+     */
+    ReadWeight(""),
 
     /**
-     * 心跳
+     * 读取重量反馈
      */
-    heartbeatDB("DB11.0.0");
+    returnWeight("");
 
     private String db;
 

+ 12 - 12
warewms-system/src/main/java/com/warewms/hailiang/init/TcpServiceRunner.java

@@ -40,18 +40,18 @@ public class TcpServiceRunner implements CommandLineRunner {
             Object o = aClass.newInstance();
             if (o instanceof TCPConnectBase) {
                 TCPConnectBase nodeModel = (TCPConnectBase) o;
-                threadPoolTaskExecutor.execute(() -> {
-                    try {
-                        nodeModel.init();
-                        System.out.println(aClass.getSimpleName());
-                        TCPInstanceList.put(aClass.getSimpleName(),nodeModel);
-                    } catch (IOException e) {
-                        nodeModel.close();
-                        throw new RuntimeException(e);
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                });
+//                threadPoolTaskExecutor.execute(() -> {
+//                    try {
+//                        nodeModel.init();
+//                        System.out.println(aClass.getSimpleName());
+//                        TCPInstanceList.put(aClass.getSimpleName(),nodeModel);
+//                    } catch (IOException e) {
+//                        nodeModel.close();
+//                        throw new RuntimeException(e);
+//                    } catch (InterruptedException e) {
+//                        throw new RuntimeException(e);
+//                    }
+//                });
             }
         }
     }

+ 16 - 0
warewms-system/src/main/java/com/warewms/hailiang/service/DeviceService.java

@@ -0,0 +1,16 @@
+package com.warewms.hailiang.service;
+
+import com.warewms.common.core.domain.base.page.PageDomain;
+import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.hailiang.domian.Device;
+import com.warewms.hailiang.domian.DeviceLog;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 设备管理service
+ */
+public interface DeviceService {
+    List<Device> getList();
+}

+ 4 - 4
warewms-system/src/main/java/com/warewms/system/config/SecurityConfig.java

@@ -22,7 +22,7 @@ import org.springframework.web.filter.CorsFilter;
 
 /**
  * spring security配置
- * 
+ *
  * @author ruoyi
  */
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private UserDetailsService userDetailsService;
-    
+
     /**
      * 认证失败处理类
      */
@@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private JwtAuthenticationTokenFilter authenticationTokenFilter;
-    
+
     /**
      * 跨域过滤器
      */
@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register").permitAll()
+                .antMatchers("/login", "/register","/test/**").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 24 - 0
warewms-system/src/main/resources/mapper/hailiang/DeviceLogMapper.xml

@@ -0,0 +1,24 @@
+<?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="com.warewms.hailiang.mapper.DeviceLogMapper">
+
+    <resultMap id="BaseResultMap" type="com.warewms.hailiang.domian.DeviceLog">
+            <id property="deviceLogId" column="device_log_id" jdbcType="BIGINT"/>
+            <result property="deviceId" column="device_id" jdbcType="VARCHAR"/>
+            <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
+            <result property="content" column="content" jdbcType="VARCHAR"/>
+            <result property="status" column="status" jdbcType="CHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="remark" column="remark" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        device_log_id,device_id,device_name,
+        content,status,create_time,
+        update_by,update_time,remark
+    </sql>
+</mapper>