1
|
package com.tianbo.analysis.controller;
|
1
|
package com.tianbo.analysis.controller;
|
2
|
|
2
|
|
|
|
3
|
+import lombok.extern.slf4j.Slf4j;
|
3
|
import org.apache.commons.io.FileUtils;
|
4
|
import org.apache.commons.io.FileUtils;
|
4
|
import org.springframework.beans.factory.annotation.Value;
|
5
|
import org.springframework.beans.factory.annotation.Value;
|
5
|
import org.springframework.web.bind.annotation.PostMapping;
|
6
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -15,6 +16,7 @@ import java.util.UUID; |
|
@@ -15,6 +16,7 @@ import java.util.UUID; |
15
|
*/
|
16
|
*/
|
16
|
@RestController
|
17
|
@RestController
|
17
|
@RequestMapping("/Rmsg")
|
18
|
@RequestMapping("/Rmsg")
|
|
|
19
|
+@Slf4j
|
18
|
public class RadioMsgController {
|
20
|
public class RadioMsgController {
|
19
|
|
21
|
|
20
|
//备份目录
|
22
|
//备份目录
|
|
@@ -60,14 +62,17 @@ public class RadioMsgController { |
|
@@ -60,14 +62,17 @@ public class RadioMsgController { |
60
|
|
62
|
|
61
|
@PostMapping("ffm")
|
63
|
@PostMapping("ffm")
|
62
|
public int extFFM(String ffmmsg){
|
64
|
public int extFFM(String ffmmsg){
|
63
|
- ffmmsg = FFM_HEADER + ffmmsg;
|
|
|
64
|
- ffmmsg = ffmmsg + FFM_FOOTER;
|
|
|
65
|
- File file = new File(extRedioMsgDir+UUID.randomUUID()+".txt");
|
|
|
66
|
- try {
|
|
|
67
|
- FileUtils.writeStringToFile(file,ffmmsg,"UTF-8");
|
|
|
68
|
- return 1;
|
|
|
69
|
- }catch (IOException e){
|
|
|
70
|
- e.printStackTrace();
|
65
|
+ if (ffmmsg!=null){
|
|
|
66
|
+ ffmmsg = FFM_HEADER + ffmmsg;
|
|
|
67
|
+ ffmmsg = ffmmsg + FFM_FOOTER;
|
|
|
68
|
+ File file = new File(extRedioMsgDir+UUID.randomUUID()+".txt");
|
|
|
69
|
+ try {
|
|
|
70
|
+ FileUtils.writeStringToFile(file,ffmmsg,"UTF-8");
|
|
|
71
|
+ log.info("FFM报文导入成功");
|
|
|
72
|
+ return 1;
|
|
|
73
|
+ }catch (IOException e){
|
|
|
74
|
+ e.printStackTrace();
|
|
|
75
|
+ }
|
71
|
}
|
76
|
}
|
72
|
return 0;
|
77
|
return 0;
|
73
|
}
|
78
|
}
|
|
@@ -75,28 +80,34 @@ public class RadioMsgController { |
|
@@ -75,28 +80,34 @@ public class RadioMsgController { |
75
|
|
80
|
|
76
|
@PostMapping("fwb")
|
81
|
@PostMapping("fwb")
|
77
|
public int extFWB(String ffmmsg){
|
82
|
public int extFWB(String ffmmsg){
|
78
|
- ffmmsg = FWB_HEADER + ffmmsg;
|
|
|
79
|
- ffmmsg = ffmmsg + FWB_FOOTER;
|
|
|
80
|
- File file = new File(extRedioMsgDir+UUID.randomUUID()+".txt");
|
|
|
81
|
- try {
|
|
|
82
|
- FileUtils.writeStringToFile(file,ffmmsg,"UTF-8");
|
|
|
83
|
- return 1;
|
|
|
84
|
- }catch (IOException e){
|
|
|
85
|
- e.printStackTrace();
|
83
|
+ if (ffmmsg!=null) {
|
|
|
84
|
+ ffmmsg = FWB_HEADER + ffmmsg;
|
|
|
85
|
+ ffmmsg = ffmmsg + FWB_FOOTER;
|
|
|
86
|
+ File file = new File(extRedioMsgDir + UUID.randomUUID() + ".txt");
|
|
|
87
|
+ try {
|
|
|
88
|
+ FileUtils.writeStringToFile(file, ffmmsg, "UTF-8");
|
|
|
89
|
+ log.info("FWB报文导入成功");
|
|
|
90
|
+ return 1;
|
|
|
91
|
+ } catch (IOException e) {
|
|
|
92
|
+ e.printStackTrace();
|
|
|
93
|
+ }
|
86
|
}
|
94
|
}
|
87
|
return 0;
|
95
|
return 0;
|
88
|
}
|
96
|
}
|
89
|
|
97
|
|
90
|
@PostMapping("fhl")
|
98
|
@PostMapping("fhl")
|
91
|
public int extFHL(String ffmmsg){
|
99
|
public int extFHL(String ffmmsg){
|
92
|
- ffmmsg = FHL_HEADER + ffmmsg;
|
|
|
93
|
- ffmmsg = ffmmsg + FHL_FOOTER;
|
|
|
94
|
- File file = new File(extRedioMsgDir+UUID.randomUUID()+".txt");
|
|
|
95
|
- try {
|
|
|
96
|
- FileUtils.writeStringToFile(file,ffmmsg,"UTF-8");
|
|
|
97
|
- return 1;
|
|
|
98
|
- }catch (IOException e){
|
|
|
99
|
- e.printStackTrace();
|
100
|
+ if (ffmmsg!=null) {
|
|
|
101
|
+ ffmmsg = FHL_HEADER + ffmmsg;
|
|
|
102
|
+ ffmmsg = ffmmsg + FHL_FOOTER;
|
|
|
103
|
+ File file = new File(extRedioMsgDir + UUID.randomUUID() + ".txt");
|
|
|
104
|
+ try {
|
|
|
105
|
+ FileUtils.writeStringToFile(file, ffmmsg, "UTF-8");
|
|
|
106
|
+ log.info("FHL报文导入成功");
|
|
|
107
|
+ return 1;
|
|
|
108
|
+ } catch (IOException e) {
|
|
|
109
|
+ e.printStackTrace();
|
|
|
110
|
+ }
|
100
|
}
|
111
|
}
|
101
|
return 0;
|
112
|
return 0;
|
102
|
}
|
113
|
}
|