diff --git a/src/main/java/com/casic/controller/DeviceDataController.java b/src/main/java/com/casic/controller/DeviceDataController.java index 3498b04..d7e3722 100644 --- a/src/main/java/com/casic/controller/DeviceDataController.java +++ b/src/main/java/com/casic/controller/DeviceDataController.java @@ -1,19 +1,19 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.DeviceDataService; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; @RestController @RequestMapping("/device") +@RequiredArgsConstructor public class DeviceDataController { - private final DeviceDataService deviceDataService; - public DeviceDataController(DeviceDataService deviceDataService) { - this.deviceDataService = deviceDataService; - } + private final DeviceDataService deviceDataService; @RequestMapping("/recent-data") public Object getDeviceRecentData(@RequestParam(value = "deviceType", required = true) String deviceType, @@ -35,4 +35,6 @@ return deviceDataService.getLevel(deviceType); } + + } diff --git a/src/main/java/com/casic/controller/DeviceDataController.java b/src/main/java/com/casic/controller/DeviceDataController.java index 3498b04..d7e3722 100644 --- a/src/main/java/com/casic/controller/DeviceDataController.java +++ b/src/main/java/com/casic/controller/DeviceDataController.java @@ -1,19 +1,19 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.DeviceDataService; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; @RestController @RequestMapping("/device") +@RequiredArgsConstructor public class DeviceDataController { - private final DeviceDataService deviceDataService; - public DeviceDataController(DeviceDataService deviceDataService) { - this.deviceDataService = deviceDataService; - } + private final DeviceDataService deviceDataService; @RequestMapping("/recent-data") public Object getDeviceRecentData(@RequestParam(value = "deviceType", required = true) String deviceType, @@ -35,4 +35,6 @@ return deviceDataService.getLevel(deviceType); } + + } diff --git a/src/main/java/com/casic/controller/MessagePusherController.java b/src/main/java/com/casic/controller/MessagePusherController.java index b97dcd1..d27acf8 100644 --- a/src/main/java/com/casic/controller/MessagePusherController.java +++ b/src/main/java/com/casic/controller/MessagePusherController.java @@ -1,6 +1,9 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.MessagePusherService; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.io.UnsupportedEncodingException; @@ -9,15 +12,12 @@ import java.util.Map; @RestController +@RequiredArgsConstructor public class MessagePusherController { private final MessagePusherService messagePusherService; - public MessagePusherController(MessagePusherService messagePusherService) { - this.messagePusherService = messagePusherService; - } - /*** * 更新sink生成工单的接单时间,及建立超期未接工单的处理任务 @@ -32,9 +32,7 @@ } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - return retMap; } - //报警开关按钮 - // - + return retMap; + } } diff --git a/src/main/java/com/casic/controller/DeviceDataController.java b/src/main/java/com/casic/controller/DeviceDataController.java index 3498b04..d7e3722 100644 --- a/src/main/java/com/casic/controller/DeviceDataController.java +++ b/src/main/java/com/casic/controller/DeviceDataController.java @@ -1,19 +1,19 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.DeviceDataService; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; @RestController @RequestMapping("/device") +@RequiredArgsConstructor public class DeviceDataController { - private final DeviceDataService deviceDataService; - public DeviceDataController(DeviceDataService deviceDataService) { - this.deviceDataService = deviceDataService; - } + private final DeviceDataService deviceDataService; @RequestMapping("/recent-data") public Object getDeviceRecentData(@RequestParam(value = "deviceType", required = true) String deviceType, @@ -35,4 +35,6 @@ return deviceDataService.getLevel(deviceType); } + + } diff --git a/src/main/java/com/casic/controller/MessagePusherController.java b/src/main/java/com/casic/controller/MessagePusherController.java index b97dcd1..d27acf8 100644 --- a/src/main/java/com/casic/controller/MessagePusherController.java +++ b/src/main/java/com/casic/controller/MessagePusherController.java @@ -1,6 +1,9 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.MessagePusherService; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.io.UnsupportedEncodingException; @@ -9,15 +12,12 @@ import java.util.Map; @RestController +@RequiredArgsConstructor public class MessagePusherController { private final MessagePusherService messagePusherService; - public MessagePusherController(MessagePusherService messagePusherService) { - this.messagePusherService = messagePusherService; - } - /*** * 更新sink生成工单的接单时间,及建立超期未接工单的处理任务 @@ -32,9 +32,7 @@ } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - return retMap; } - //报警开关按钮 - // - + return retMap; + } } diff --git a/src/main/java/com/casic/controller/ThirdDataController.java b/src/main/java/com/casic/controller/ThirdDataController.java index 1ca5eb6..bdaed51 100644 --- a/src/main/java/com/casic/controller/ThirdDataController.java +++ b/src/main/java/com/casic/controller/ThirdDataController.java @@ -2,7 +2,9 @@ import com.alibaba.fastjson.JSON; import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,11 +16,9 @@ @Slf4j public class ThirdDataController { - private final ThirdDataService thirdDataService; + @Autowired + private ThirdDataService thirdDataService; - public ThirdDataController(ThirdDataService thirdDataService) { - this.thirdDataService = thirdDataService; - } /** * 硫化氢订阅接口 @@ -26,12 +26,11 @@ * @param h2sDataMap * @return */ - @RequestMapping("/h2s-data") + @RequestMapping("/data") public Object h2sData(@RequestBody Map h2sDataMap) { System.out.println(JSON.toJSON(h2sDataMap)); return thirdDataService.h2sData(h2sDataMap); } - } diff --git a/src/main/java/com/casic/controller/DeviceDataController.java b/src/main/java/com/casic/controller/DeviceDataController.java index 3498b04..d7e3722 100644 --- a/src/main/java/com/casic/controller/DeviceDataController.java +++ b/src/main/java/com/casic/controller/DeviceDataController.java @@ -1,19 +1,19 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.DeviceDataService; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; @RestController @RequestMapping("/device") +@RequiredArgsConstructor public class DeviceDataController { - private final DeviceDataService deviceDataService; - public DeviceDataController(DeviceDataService deviceDataService) { - this.deviceDataService = deviceDataService; - } + private final DeviceDataService deviceDataService; @RequestMapping("/recent-data") public Object getDeviceRecentData(@RequestParam(value = "deviceType", required = true) String deviceType, @@ -35,4 +35,6 @@ return deviceDataService.getLevel(deviceType); } + + } diff --git a/src/main/java/com/casic/controller/MessagePusherController.java b/src/main/java/com/casic/controller/MessagePusherController.java index b97dcd1..d27acf8 100644 --- a/src/main/java/com/casic/controller/MessagePusherController.java +++ b/src/main/java/com/casic/controller/MessagePusherController.java @@ -1,6 +1,9 @@ package com.casic.controller; +import com.alibaba.fastjson.JSON; import com.casic.service.MessagePusherService; +import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.io.UnsupportedEncodingException; @@ -9,15 +12,12 @@ import java.util.Map; @RestController +@RequiredArgsConstructor public class MessagePusherController { private final MessagePusherService messagePusherService; - public MessagePusherController(MessagePusherService messagePusherService) { - this.messagePusherService = messagePusherService; - } - /*** * 更新sink生成工单的接单时间,及建立超期未接工单的处理任务 @@ -32,9 +32,7 @@ } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - return retMap; } - //报警开关按钮 - // - + return retMap; + } } diff --git a/src/main/java/com/casic/controller/ThirdDataController.java b/src/main/java/com/casic/controller/ThirdDataController.java index 1ca5eb6..bdaed51 100644 --- a/src/main/java/com/casic/controller/ThirdDataController.java +++ b/src/main/java/com/casic/controller/ThirdDataController.java @@ -2,7 +2,9 @@ import com.alibaba.fastjson.JSON; import com.casic.service.ThirdDataService; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,11 +16,9 @@ @Slf4j public class ThirdDataController { - private final ThirdDataService thirdDataService; + @Autowired + private ThirdDataService thirdDataService; - public ThirdDataController(ThirdDataService thirdDataService) { - this.thirdDataService = thirdDataService; - } /** * 硫化氢订阅接口 @@ -26,12 +26,11 @@ * @param h2sDataMap * @return */ - @RequestMapping("/h2s-data") + @RequestMapping("/data") public Object h2sData(@RequestBody Map h2sDataMap) { System.out.println(JSON.toJSON(h2sDataMap)); return thirdDataService.h2sData(h2sDataMap); } - } diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 3c91579..d06a1af 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -33,7 +33,7 @@ password: ew5T4K3#203lwh config-prefix: 'Casic:' online: - cron: 0 0/1 * * * ? # 多长时间判断离线 + cron: 0 0 0/1 * * ? # 多长时间判断离线 data-day: 3 #多少天为离线 type: 14 #硫化氢