diff --git a/src/main/java/com/dreamworks/boditech/configuration/WebConfig.java b/src/main/java/com/dreamworks/boditech/configuration/WebConfig.java index 98665ec..60d0ad8 100644 --- a/src/main/java/com/dreamworks/boditech/configuration/WebConfig.java +++ b/src/main/java/com/dreamworks/boditech/configuration/WebConfig.java @@ -1,2 +1,16 @@ -package com.dreamworks.boditech.configuration;public class WebConfig { +package com.dreamworks.boditech.configuration; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +@Configuration +public class WebConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowCredentials(true) + .allowedOriginPatterns("*") + .allowedMethods("GET", "POST", "PUT", "DELETE") + .allowedHeaders("*") + .exposedHeaders("*"); + } } diff --git a/src/main/java/com/dreamworks/boditech/controller/AccountController.java b/src/main/java/com/dreamworks/boditech/controller/AccountController.java index fa7d3d6..1515e75 100644 --- a/src/main/java/com/dreamworks/boditech/controller/AccountController.java +++ b/src/main/java/com/dreamworks/boditech/controller/AccountController.java @@ -8,9 +8,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; - import java.util.Map; - @Controller public class AccountController extends BaseController { @Resource diff --git a/src/main/java/com/dreamworks/boditech/controller/DeviceController.java b/src/main/java/com/dreamworks/boditech/controller/DeviceController.java index 014ad52..a1c56cd 100644 --- a/src/main/java/com/dreamworks/boditech/controller/DeviceController.java +++ b/src/main/java/com/dreamworks/boditech/controller/DeviceController.java @@ -171,12 +171,26 @@ public class DeviceController extends BaseController { - + private Integer initCount = 3; @ResponseBody @PostMapping("/api/device/init") public ApiResponse init() { - this.deviceService.reset(false); - return this.success(); + if ( initCount > 0 ) { + this.initCount --; + ApiResponse response = new ApiResponse(); + response.success = false; + response.message = ""; + response.data = List.of( + Map.of("message","请确认试管帽夹中无试管帽","type","manual"), + Map.of("message","移液枪复位","type","auto"), + Map.of("message","机械臂复位","type","auto"), + Map.of("message","孵育盘复位","type","auto") + ); + return response; + } else { + this.initCount = 3; + return this.success(); + } }