diff --git a/src/main/java/com/dreamworks/boditech/controller/TestController.java b/src/main/java/com/dreamworks/boditech/controller/TestController.java index e68b709..10b9687 100644 --- a/src/main/java/com/dreamworks/boditech/controller/TestController.java +++ b/src/main/java/com/dreamworks/boditech/controller/TestController.java @@ -1,6 +1,7 @@ package com.dreamworks.boditech.controller; import com.dreamworks.boditech.controller.entity.ApiResponse; import com.dreamworks.boditech.entity.*; +import com.dreamworks.boditech.entity.parameter.ParamBatchDeleteById; import com.dreamworks.boditech.entity.parameter.ParamEmergencyTaskSave; import com.dreamworks.boditech.entity.parameter.ParamTestSearch; import com.dreamworks.boditech.entity.parameter.ParamTestTubeRackTaskSave; @@ -173,14 +174,6 @@ public class TestController extends BaseController { List tests = this.testService.testSearch(params); for ( MdbTest test : tests ) { Map item = MyCommon.objectToMap(test); - Long letfTime = test.incubateStartedAt + test.incubateTime - System.currentTimeMillis(); - if ( letfTime < 0 ) { - letfTime = 0L; - } - letfTime /= 1000; - Integer sec = (int)(letfTime % 60); - Integer min = (int)(letfTime / 60); - item.put("incubateLeftTime", String.format("%02d:%02d", min, sec)); item.put("results", MyCommon.jsonToObject(test.result, List.class)); list.add(item); } @@ -193,6 +186,13 @@ public class TestController extends BaseController { } @ResponseBody + @PostMapping("/api/test/batch-delete") + public ApiResponse batchDelete( @RequestBody ParamBatchDeleteById params ) { + this.testService.testBatchDeleteById(params); + return this.success(); + } + + @ResponseBody @PostMapping("/api/test/test-tube-rack-status-get") public ApiResponse testTubeRackStatusGet() { MdbTestTubeRackTestTask task = this.testService.testTubeRackTaskCurrentGet(); diff --git a/src/main/java/com/dreamworks/boditech/driver/Device.java b/src/main/java/com/dreamworks/boditech/driver/Device.java index a520762..dbc3b9a 100644 --- a/src/main/java/com/dreamworks/boditech/driver/Device.java +++ b/src/main/java/com/dreamworks/boditech/driver/Device.java @@ -64,7 +64,7 @@ public class Device { // message index private short messageIndex = 0; // device ready - private Boolean isReady = false; + private Boolean isReady = true; @PostConstruct public void init() { diff --git a/src/main/java/com/dreamworks/boditech/entity/parameter/ParamTestSearch.java b/src/main/java/com/dreamworks/boditech/entity/parameter/ParamTestSearch.java index c7b325c..28a9219 100644 --- a/src/main/java/com/dreamworks/boditech/entity/parameter/ParamTestSearch.java +++ b/src/main/java/com/dreamworks/boditech/entity/parameter/ParamTestSearch.java @@ -4,8 +4,4 @@ public class ParamTestSearch { public Integer offset = 0; // limit public Integer limit = 10; - // order by - public String orderBy = "id"; - // order - public String order = "DESC"; } diff --git a/src/main/java/com/dreamworks/boditech/mapper/TestMapper.java b/src/main/java/com/dreamworks/boditech/mapper/TestMapper.java index 9de7df2..43faa13 100644 --- a/src/main/java/com/dreamworks/boditech/mapper/TestMapper.java +++ b/src/main/java/com/dreamworks/boditech/mapper/TestMapper.java @@ -27,7 +27,7 @@ public interface TestMapper { @Select("SELECT COUNT(*) FROM bdt_tests WHERE taskId = #{taskId} AND taskType = #{taskType} AND status = 'FINISHED'") Integer countFinishedTestsByTaskId(Integer taskId, String taskType); - @Select("SELECT * FROM bdt_tests ORDER BY #{orderBy} #{order} LIMIT #{offset}, #{limit}") + @Select("SELECT * FROM bdt_tests WHERE status = 'FINISHED' ORDER BY id DESC LIMIT #{offset}, #{limit}") List search(ParamTestSearch param); @Select("SELECT COUNT(*) FROM bdt_tests") @@ -47,4 +47,12 @@ public interface TestMapper { @Update("UPDATE bdt_tests SET status = 'CANCELED' WHERE status != 'FINISHED'") void cancelAllTasks(); + + @Delete( + "" + ) + void batchDeleteById(List idList); } diff --git a/src/main/java/com/dreamworks/boditech/service/TestService.java b/src/main/java/com/dreamworks/boditech/service/TestService.java index 2643d1f..e46cb10 100644 --- a/src/main/java/com/dreamworks/boditech/service/TestService.java +++ b/src/main/java/com/dreamworks/boditech/service/TestService.java @@ -4,10 +4,7 @@ import com.dreamworks.boditech.driver.task.TaskTestEmergency; import com.dreamworks.boditech.driver.task.TaskTestRegular; import com.dreamworks.boditech.driver.task.TaskTestTubeRackPrepare; import com.dreamworks.boditech.entity.*; -import com.dreamworks.boditech.entity.parameter.ParamEmergencyTaskSave; -import com.dreamworks.boditech.entity.parameter.ParamTestSearch; -import com.dreamworks.boditech.entity.parameter.ParamTestTubeRackTaskSave; -import com.dreamworks.boditech.entity.parameter.ParamTestTubeRackTaskSaveTube; +import com.dreamworks.boditech.entity.parameter.*; import com.dreamworks.boditech.mapper.*; import com.dreamworks.boditech.utils.AppError; import com.dreamworks.boditech.utils.AppRuntimeException; @@ -359,6 +356,10 @@ public class TestService { return this.testMapper.activeBatchList(this.batchId); } + public void testBatchDeleteById(ParamBatchDeleteById param) { + this.actionLog.log("test.batch-delete"); + this.testMapper.batchDeleteById(param.idList); + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b36ded0..c94dd71 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,4 +3,8 @@ spring: active: dev messages: basename: static/i18n/messages - encoding: utf-8 \ No newline at end of file + encoding: utf-8 + +#mybatis: +# configuration: +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file