diff --git a/pom.xml b/pom.xml
index 0b6df18..f82caa9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,8 @@
ym-basic
ym-schedule-task
ym-websocket
+ ym-packing
+ ym-s7
pom
diff --git a/ym-gateway/pom.xml b/ym-gateway/pom.xml
index 713f8da..455a248 100644
--- a/ym-gateway/pom.xml
+++ b/ym-gateway/pom.xml
@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- ym-pass
com.cnbm
+ ym-pass
1.0-SNAPSHOT
4.0.0
@@ -22,11 +22,31 @@
ym-common
1.0-SNAPSHOT
+
+ com.cnbm
+ ym-s7
+ 1.0-SNAPSHOT
+
+
+
+
+ com.cnbm
+ ym-packing
+ 1.0-SNAPSHOT
+
+
com.cnbm
ym-admin
1.0-SNAPSHOT
+
+
+ com.cnbm
+ ym-packing
+ 1.0-SNAPSHOT
+
+
com.cnbm
ym-barcode
diff --git a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
index 730a480..d84ac01 100644
--- a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
+++ b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
@@ -54,6 +54,22 @@ public class SwaggerConfig {
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}
+ @Bean
+ public Docket packingApi() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .groupName("ym-packing")
+ .apiInfo(apiInfo("包装模块", "V1"))
+ .useDefaultResponseMessages(true)
+ .forCodeGeneration(false)
+ .select()
+ .apis(RequestHandlerSelectors.basePackage("com.cnbm.packing"))
+ .paths(PathSelectors.any())
+ .build()
+ .securityContexts(Arrays.asList(securityContext()))
+ // ApiKey的name需与SecurityReference的reference保持一致
+ .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
+ }
+
@Bean
public Docket adminApi() {
return new Docket(DocumentationType.SWAGGER_2)
@@ -69,6 +85,21 @@ public class SwaggerConfig {
// ApiKey的name需与SecurityReference的reference保持一致
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}
+ @Bean
+ public Docket s7Api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .groupName("ym-s7")
+ .apiInfo(apiInfo("基于西门子S7协议采集模块", "基于西门子S7协议采集模块"))
+ .useDefaultResponseMessages(true)
+ .forCodeGeneration(false)
+ .select()
+ .apis(RequestHandlerSelectors.basePackage("com.cnbm.s7"))
+ .paths(PathSelectors.any())
+ .build()
+ .securityContexts(Arrays.asList(securityContext()))
+ // ApiKey的name需与SecurityReference的reference保持一致
+ .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
+ }
/**
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml
index dd83b23..e2a1db0 100644
--- a/ym-gateway/src/main/resources/application.yml
+++ b/ym-gateway/src/main/resources/application.yml
@@ -7,7 +7,7 @@ server:
min-spare: 30
port: 8080
servlet:
- context-path: /ym-pass
+ context-path: /ym-cigs4
session:
cookie:
http-only: true
diff --git a/ym-packing/pom.xml b/ym-packing/pom.xml
new file mode 100644
index 0000000..c3b729f
--- /dev/null
+++ b/ym-packing/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ com.cnbm
+ ym-pass
+ 1.0-SNAPSHOT
+
+
+ ym-packing
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ com.cnbm
+ ym-common
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/Main.java b/ym-packing/src/main/java/com/cnbm/packing/Main.java
new file mode 100644
index 0000000..c8e809d
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/Main.java
@@ -0,0 +1,7 @@
+package com.cnbm.packing;
+
+public class Main {
+ public static void main(String[] args) {
+ System.out.println("Hello world!");
+ }
+}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java
new file mode 100644
index 0000000..f61c559
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java
@@ -0,0 +1,24 @@
+package com.cnbm.packing.controller;
+
+import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.*;
+import com.cnbm.common.utils.Result;
+/**
+ * @Author weihongyang
+ * @Date 2022/6/24 8:57 AM
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/packing")
+public class TestController {
+
+ @GetMapping("get")
+ public Result get(){
+ return new Result().ok(1);
+ }
+
+ @PostMapping("get2")
+ public Result get2(){
+ return new Result().ok(2);
+ }
+}
diff --git a/ym-s7/pom.xml b/ym-s7/pom.xml
new file mode 100644
index 0000000..6145cba
--- /dev/null
+++ b/ym-s7/pom.xml
@@ -0,0 +1,40 @@
+
+
+ 4.0.0
+
+ com.cnbm
+ ym-pass
+ 1.0-SNAPSHOT
+
+
+ ym-s7
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ org.springframework.retry
+ spring-retry
+ 1.2.2.RELEASE
+
+
+ org.testng
+ testng
+ 6.11
+ compile
+
+
+ junit
+ junit
+
+
+
+
+
\ No newline at end of file
diff --git a/ym-s7/src/main/java/com/cnbm/Main.java b/ym-s7/src/main/java/com/cnbm/Main.java
new file mode 100644
index 0000000..ed8fa4f
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/Main.java
@@ -0,0 +1,7 @@
+package com.cnbm;
+
+public class Main {
+ public static void main(String[] args) {
+ System.out.println("Hello world!");
+ }
+}
\ No newline at end of file
diff --git a/ym-s7/src/main/java/com/cnbm/s7/controller/S7DemoController.java b/ym-s7/src/main/java/com/cnbm/s7/controller/S7DemoController.java
new file mode 100644
index 0000000..98976f9
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/controller/S7DemoController.java
@@ -0,0 +1,270 @@
+package com.cnbm.s7.controller;
+
+import com.cnbm.s7.entity.R;
+import com.cnbm.s7.entity.AGVInfoCallBack;
+
+import com.cnbm.s7.s7connector.enmuc.PlcVarActual;
+
+
+import com.cnbm.s7.s7connector.enmuc.S7Client;
+import com.cnbm.s7.s7connector.type.PlcVar;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+import java.io.UnsupportedEncodingException;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+@RestController
+@RequestMapping("/s7")
+public class S7DemoController {
+ private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
+
+// @Autowired
+// InfluxDBClient influxDBClient;
+//
+// @PostMapping("/insert")
+// public void insert() throws InterruptedException {
+// Event event = new Event();
+// event.setTime(Instant.now());
+// event.setTransationId("asasd11");
+// event.setArgName("argName11");
+// event.setArgValue(7d);
+// Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEventSSS");
+// influxDBClient.makeWriteApi().writePoint(asProcessCompleteEvent);
+// }
+
+ @PostMapping(value = "testFor")
+ private void testFor(@RequestBody AGVInfoCallBack agvInfoCallBack) {
+
+ System.out.println(agvInfoCallBack.toString());
+ }
+
+ //demo1
+ @PostMapping("/testReadAll")
+ public R testReadAll() throws UnsupportedEncodingException, ParseException {
+ for(PlcVarActual actual:PlcVarActual.values()){
+ System.out.println(read(S7Client.S7_1500,actual));
+ }
+ return R.ok();
+ }
+// public Point insert(Event event, String measurement){
+// Point point = Point.measurement(measurement)
+// .addTag("transationId", event.getTransationId())
+// .addTag("argName", event.getArgName())
+// .addField("argValue", event.getArgValue())
+// .time(event.getTime().toEpochMilli(), WritePrecision.MS);
+// return point;
+// }
+ //demo2
+ @PostMapping("/readTest")
+ public R getTestForS7() throws UnsupportedEncodingException, ParseException {
+ Boolean heartBeat = (Boolean)read(S7Client.S7_1500,PlcVarActual.HeartBeat);
+ String ddtl = (String)read(S7Client.S7_1500,PlcVarActual.DTL);
+ List characters = (List)read(S7Client.S7_1500,PlcVarActual.CharArrays);
+
+ List booleans = (List)read(S7Client.S7_1500,PlcVarActual.BooleanArrays);
+
+ String stri = (String)read(S7Client.S7_1500,PlcVarActual.STRING1);
+
+ return R.ok().put("res",heartBeat).put("characters",characters).put("ddtl",ddtl).put("bools",booleans).put("str",stri);
+ }
+
+
+ @PostMapping("/readTest2")
+ public R getTest2ForS7() throws Exception {
+// List characters = (List)read(PlcVarActual.CharArrays,S7Client.S7_1500);
+//
+// List booleans = (List)read(PlcVarActual.BooleanArrays,S7Client.S7_1500);
+// String stri = (String)read(PlcVarActual.STRING1,S7Client.S7_1500);
+//
+// return R.ok().put("res",heartBeat).put("characters",characters).put("ddtl",ddtl).put("bools",booleans).put("str",stri);
+ String con = "1233ADSDA";
+ write(S7Client.S7_1500,PlcVarActual.STRING1, con);
+ String read = (String)read(S7Client.S7_1500,PlcVarActual.STRING1);
+ String sub0 = (String)read(S7Client.S7_1500,PlcVarActual.SUBID0);
+
+
+ return R.ok().put("str",read).put("sub0",sub0);
+ }
+
+ @PostMapping("/testWriteBooleanArray")
+ public R testWriteBooleanArray() throws Exception {
+
+ List string = (List)read(S7Client.S7_1500,PlcVarActual.BooleanArrays1200);
+ System.out.println();
+ boolean[] res = new boolean[15];
+ res[0] = false;
+ res[1] = true;
+ res[2] = false;
+ res[3] = true;
+ res[4] = false;
+ res[5] = true;
+ res[6] = false;
+ res[7] = false;
+ res[8] = false;
+ res[9] = true;
+ res[10] = false;
+ res[11] = false;
+ res[12] = true;
+ res[13] = false;
+ res[14] = true;
+ write(S7Client.S7_1500,PlcVarActual.BooleanArrays1200, res);
+ System.out.println();
+ return R.ok();
+ }
+
+ @PostMapping("/testForString")
+ public R testForStrings() throws Exception {
+ //测试结果 l => 66ms
+ long l = System.currentTimeMillis();
+ String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays);
+ long l1 = System.currentTimeMillis();
+
+ long dl = System.currentTimeMillis();
+ String string = (String)read(S7Client.S7_1500,PlcVarActual.STRING1);
+ long dl1 = System.currentTimeMillis();
+
+ String[] toWrite = new String[60];
+ for(int i=0;i<60;i++){
+ int i1 = new Random().nextInt(100);
+ toWrite[i] = "2212"+ i1;
+ }
+ ////测试结果 c => 57ms
+ long c1 = System.currentTimeMillis();
+ write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite);
+ long c2 = System.currentTimeMillis();
+ String s = "cai xiang";
+ write(S7Client.S7_1500,PlcVarActual.STRING1,s);
+
+ String string2 = (String)read(S7Client.S7_1500,PlcVarActual.STRING1);
+ String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays);
+
+ return R.ok().put("l",(l1-l)).put("c",(c2-c1)).put("dl",(dl1-dl));
+ }
+
+ @PostMapping("/testForString1200")
+ public R testForString1200() throws Exception {
+ //测试结果 l => 66ms
+ long l = System.currentTimeMillis();
+ String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays1200); //65ms
+ long l1 = System.currentTimeMillis();
+ //System.out.println(Arrays.toString(subs));
+
+ String[] toWrite = new String[63];
+ for(int i=0;i<63;i++){
+ //int i1 = new Random().nextInt(100);
+ toWrite[i] = "abcd-"+ i;
+ }
+ ////测试结果 c => 57ms
+ long c1 = System.currentTimeMillis();
+ write(S7Client.S7_1500,PlcVarActual.SubIdArrays1200,toWrite);
+ long c2 = System.currentTimeMillis();
+
+ String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays1200);
+ logger.info("正常测试: l:"+(l1-l)+"c:"+(c2-c1)+";;read1:"+Arrays.toString(subs)+";;read2:"+Arrays.toString(subs2));
+
+ return R.ok().put("l",(l1-l)).put("c",(c2-c1));
+ }
+
+ @PostMapping("/testForString1500")
+ public R testForString1500() throws Exception {
+ //测试结果 l => 66ms
+ long l = System.currentTimeMillis();
+ String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays); //25ms
+ long l1 = System.currentTimeMillis();
+ System.out.println(Arrays.toString(subs));
+ String[] toWrite = new String[63];
+ for(int i=0;i<63;i++){
+ //int i1 = new Random().nextInt(100);
+ toWrite[i] = "abcd-"+ i;
+ }
+ ////测试结果 c => 57ms
+ long c1 = System.currentTimeMillis();
+ write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite);
+ long c2 = System.currentTimeMillis();
+
+
+ String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays);
+
+ return R.ok().put("l",(l1-l)).put("c",(c2-c1));
+ }
+
+
+
+
+
+ @PostMapping("/testFor1200")
+ public R testFor1200() throws Exception {
+ //Object subs = read(PlcVarActual.INT1200, S7Client.S7_1500);
+ Object read = read(S7Client.S7_1500, PlcVarActual.SubIdArrays1200);
+
+ String[] toWrite = new String[60];
+ for(int i=0;i<60;i++){
+ int i1 = new Random().nextInt(100);
+ toWrite[i] = "2212"+ i1;
+ }
+ write(S7Client.S7_1500,PlcVarActual.SubIdArrays1200,toWrite);
+
+ Object read2 = read(S7Client.S7_1500, PlcVarActual.SubIdArrays1200);
+ return R.ok();
+ }
+
+
+
+ //PlcVarActual 到时候改成你们的 xxxPlcToWcs 或者 xxxWcsToPlc
+ /**
+ * return
+ * 成功: 返回相应的object对象
+ * 失败: 返回null
+ * */
+ private Object read(S7Client s7Client,PlcVarActual var) throws UnsupportedEncodingException, ParseException {
+ try {
+ return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
+ }catch (Exception e){
+ logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ }
+ private void write(S7Client s7Client,PlcVarActual var,Object newValue) throws Exception {
+ if(var.getType().equals(PlcVar.STRING_Array)){
+ String[] s = (String[])newValue;
+ String[] ss = (String[])newValue;
+ if(s.length > var.getLength() ){
+ ss = new String[var.getLength()];
+ for(int i=0;i< var.getLength();i++){
+ ss[i] = s[i];
+ }
+ }
+ s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
+ }else {
+ s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
+ }
+ }
+
+// //demo3
+// @PostMapping("/writeTest")
+// public R writeTest() throws PlcConnectionException, UnsupportedEncodingException {
+// write(S7Client.S7_1500,PlcVarActual.HeartBeat, false);
+//
+// char[] charArrays_content = new char[2];
+// charArrays_content[0] = '1';
+// charArrays_content[1] = 'c';
+// write( S7Client.S7_1500,PlcVarActual.CharArrays, charArrays_content);
+//
+// boolean[] boolArrays_content = new boolean[2];
+// boolArrays_content[0] = true;
+// boolArrays_content[1] = false;
+// write(S7Client.S7_1500,PlcVarActual.BooleanArrays, boolArrays_content);
+//
+// String str = "你好啊aa";
+// //todo string 的读写有问题 待会看看
+// write(S7Client.S7_1500,PlcVarActual.STRING1, str);
+// return R.ok().put("res",true);
+// }
+
+}
diff --git a/ym-s7/src/main/java/com/cnbm/s7/demo/RetryDemoTask.java b/ym-s7/src/main/java/com/cnbm/s7/demo/RetryDemoTask.java
new file mode 100644
index 0000000..f3c05ca
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/demo/RetryDemoTask.java
@@ -0,0 +1,40 @@
+package com.cnbm.s7.demo;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.RandomUtils;
+import org.springframework.remoting.RemoteAccessException;
+
+/**
+ * @Author: zgd
+ * @Description:
+ */
+@Slf4j
+public class RetryDemoTask {
+
+
+ /**
+ * 重试方法
+ * @return
+ */
+ public static boolean retryTask(String param) {
+ log.info("收到请求参数:{}",param);
+
+ int i = RandomUtils.nextInt(0,11);
+ log.info("随机生成的数:{}",i);
+ if (i == 0) {
+ log.info("为0,抛出参数异常.");
+ throw new IllegalArgumentException("参数异常");
+ }else if (i == 1){
+ log.info("为1,返回true.");
+ return true;
+ }else if (i == 2){
+ log.info("为2,返回false.");
+ return false;
+ }else{
+ //为其他
+ log.info("大于2,抛出自定义异常.");
+ throw new RemoteAccessException("大于2,抛出远程访问异常");
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ym-s7/src/main/java/com/cnbm/s7/demo/SpringRetryTemplateTest.java b/ym-s7/src/main/java/com/cnbm/s7/demo/SpringRetryTemplateTest.java
new file mode 100644
index 0000000..59b6cab
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/demo/SpringRetryTemplateTest.java
@@ -0,0 +1,72 @@
+package com.cnbm.s7.demo;
+
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.remoting.RemoteAccessException;
+import org.springframework.retry.backoff.FixedBackOffPolicy;
+import org.springframework.retry.policy.SimpleRetryPolicy;
+import org.springframework.retry.support.RetryTemplate;
+import org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Desc: ""
+ * @Author: caixiang
+ * @DATE: 2022/12/16 15:26
+ */
+@Slf4j
+public class SpringRetryTemplateTest {
+
+ /**
+ * 重试间隔时间ms,默认1000ms
+ * */
+ private long fixedPeriodTime = 1000L;
+ /**
+ * 最大重试次数,默认为3
+ */
+ private int maxRetryTimes = 3;
+ /**
+ * 表示哪些异常需要重试,key表示异常的字节码,value为true表示需要重试
+ */
+ private Map, Boolean> exceptionMap = new HashMap<>();
+
+
+ @Test
+ public void test() {
+ exceptionMap.put(RemoteAccessException.class,true);
+
+ // 构建重试模板实例
+ RetryTemplate retryTemplate = new RetryTemplate();
+
+ // 设置重试回退操作策略,主要设置重试间隔时间
+ FixedBackOffPolicy backOffPolicy = new FixedBackOffPolicy();
+ backOffPolicy.setBackOffPeriod(fixedPeriodTime);
+
+ // 设置重试策略,主要设置重试次数
+ SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(maxRetryTimes, exceptionMap);
+
+ retryTemplate.setRetryPolicy(retryPolicy);
+ retryTemplate.setBackOffPolicy(backOffPolicy);
+
+ Boolean execute = retryTemplate.execute(
+ //RetryCallback
+ retryContext -> {
+ boolean b = RetryDemoTask.retryTask("abc");
+ log.info("调用的结果:{}", b);
+ return b;
+ },
+ retryContext -> {
+ //RecoveryCallback
+ log.info("已达到最大重试次数或抛出了不重试的异常~~~");
+ return false;
+ }
+ );
+
+ log.info("执行结果:{}",execute);
+
+ }
+
+}
diff --git a/ym-s7/src/main/java/com/cnbm/s7/entity/AGVInfoCallBack.java b/ym-s7/src/main/java/com/cnbm/s7/entity/AGVInfoCallBack.java
new file mode 100644
index 0000000..c0b185b
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/entity/AGVInfoCallBack.java
@@ -0,0 +1,24 @@
+package com.cnbm.s7.entity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 表
+ *
+ *
+ * @author caixiang
+ * @since 2022-05-31
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AGVInfoCallBack implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String warehouseName;
+ private Integer status;
+ private String content;
+}
diff --git a/ym-s7/src/main/java/com/cnbm/s7/entity/R.java b/ym-s7/src/main/java/com/cnbm/s7/entity/R.java
new file mode 100644
index 0000000..9212c2f
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/entity/R.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.cnbm.s7.entity;
+
+
+import org.springframework.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 返回数据
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public class R extends HashMap {
+ private static final long serialVersionUID = 1L;
+ //默认成功 是1
+ public R() {
+ put("code", 1);
+ put("msg", "success");
+ }
+
+ public static R error() {
+ return error(HttpStatus.INTERNAL_SERVER_ERROR.value(), "未知异常,请联系管理员");
+ }
+
+ public static R error(String msg) {
+ return error(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg);
+ }
+
+ public static R error(int code, String msg) {
+ R r = new R();
+ r.put("code", code);
+ r.put("msg", msg);
+ return r;
+ }
+
+ public static R ok(String msg) {
+ R r = new R();
+ r.put("msg", msg);
+ return r;
+ }
+
+ public static R ok(Map map) {
+ R r = new R();
+ r.putAll(map);
+ return r;
+ }
+
+ public static R ok() {
+ return new R();
+ }
+
+ @Override
+ public R put(String key, Object value) {
+ super.put(key, value);
+ return this;
+ }
+}
diff --git a/ym-s7/src/main/java/com/cnbm/s7/entity/ReadedBack.java b/ym-s7/src/main/java/com/cnbm/s7/entity/ReadedBack.java
new file mode 100644
index 0000000..d778e56
--- /dev/null
+++ b/ym-s7/src/main/java/com/cnbm/s7/entity/ReadedBack.java
@@ -0,0 +1,16 @@
+package com.cnbm.s7.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Desc: ""
+ * @Author: caixiang
+ * @DATE: 2021/12/6 13:42
+ */
+@Data
+public class ReadedBack {
+ private Integer size;
+ private List