diff --git a/src/main/java/com/iflytop/nuclear/controller/NuclearCoreController.java b/src/main/java/com/iflytop/nuclear/controller/NuclearCoreController.java index 00c0153..d1c09b8 100644 --- a/src/main/java/com/iflytop/nuclear/controller/NuclearCoreController.java +++ b/src/main/java/com/iflytop/nuclear/controller/NuclearCoreController.java @@ -23,7 +23,6 @@ import java.util.Map; @RestController @CrossOrigin @RequestMapping("/core") -@PreAuthorize("hasRole('ADMIN')") public class NuclearCoreController { @Autowired @@ -49,6 +48,7 @@ public class NuclearCoreController { } @GetMapping("/list/{id}") + @PreAuthorize("hasRole('ADMIN')") public ResponseData getListByStationId(@PathVariable(name = "id") int id) { QueryWrapper nuclearCoreQueryWrapper = new QueryWrapper<>(); nuclearCoreQueryWrapper.eq("station_id", id); @@ -59,6 +59,7 @@ public class NuclearCoreController { } @PostMapping("/add") + @PreAuthorize("hasRole('ADMIN')") public ResponseData add(@RequestBody Map coreInfo) { // 同一核电站不能存在相同的名称反应堆 不能存在相同的唯一序列号 // 不通核电站的可以相同 @@ -77,6 +78,7 @@ public class NuclearCoreController { } @PostMapping("/delete/{id}") + @PreAuthorize("hasRole('ADMIN')") public ResponseData delete(@PathVariable(name="id") String coreId) { boolean b = nuclearCoreService.removeById(coreId); JSONObject res = new JSONObject(); @@ -85,6 +87,7 @@ public class NuclearCoreController { } @PostMapping("/update/{id}") + @PreAuthorize("hasRole('ADMIN')") public ResponseData update(@PathVariable(name="id") int coreId, @RequestBody Map coreInfo) { NuclearCore nuclearCore = NuclearCore.builder() .name(coreInfo.get("name")) diff --git a/src/main/java/com/iflytop/nuclear/filter/JWTAuthenticationFilter.java b/src/main/java/com/iflytop/nuclear/filter/JWTAuthenticationFilter.java index fe3f032..23b9a28 100644 --- a/src/main/java/com/iflytop/nuclear/filter/JWTAuthenticationFilter.java +++ b/src/main/java/com/iflytop/nuclear/filter/JWTAuthenticationFilter.java @@ -57,7 +57,7 @@ public class JWTAuthenticationFilter extends UsernamePasswordAuthenticationFilte HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { - + request.setCharacterEncoding("UTF-8"); JwtUser jwtUser = (JwtUser) authResult.getPrincipal(); System.out.println("jwtUser:" + jwtUser.toString()); String role = ""; diff --git a/src/main/java/com/iflytop/nuclear/service/impl/CheckServiceImpl.java b/src/main/java/com/iflytop/nuclear/service/impl/CheckServiceImpl.java index 48b4eb5..feb0509 100644 --- a/src/main/java/com/iflytop/nuclear/service/impl/CheckServiceImpl.java +++ b/src/main/java/com/iflytop/nuclear/service/impl/CheckServiceImpl.java @@ -62,11 +62,10 @@ public class CheckServiceImpl implements CheckService { } public boolean updateCoordAndStatus(int taskId, String currentCoord, int status, boolean updateStartTime, boolean updateEndTime, Integer order) throws IOException { - UpdateWrapper taskUpdateWrapper = new UpdateWrapper<>(); - taskUpdateWrapper.eq("id",taskId); - Task task = new Task(); - task.setEndTime(null); - task.setStartTime(null); + // 根据taskId查询出来Task对象,更新时回填回去 + QueryWrapper taskQueryWrapper = new QueryWrapper<>(); + taskQueryWrapper.eq("id",taskId); + Task task = taskService.getOne(taskQueryWrapper); if (currentCoord != null){ task.setCurrentCoord(currentCoord); } @@ -81,7 +80,7 @@ public class CheckServiceImpl implements CheckService { if (order != null){ task.setCheckOrder(order); } - boolean update = taskService.update(task, taskUpdateWrapper); + boolean update = taskService.updateById(task); this.sendMessageToPage(); return update; } @@ -208,22 +207,34 @@ public class CheckServiceImpl implements CheckService { QueryWrapper pathQueryWrapper = new QueryWrapper<>(); pathQueryWrapper.eq("task_id", taskId); List pathList = pathService.list(pathQueryWrapper); + if (startIndex == null) { + // startIndex 取复杂路径第一项 + // 直接取order_number 为1 的 + for(int i=0; i < pathList.size(); i++) { + Path item = pathList.get(i); + if (item.getOrderNumber() == 1) { + startIndex = item.getCoord(); + } + } + } pathQueryWrapper.eq("coord", startIndex); Path currentPath = pathService.getOne(pathQueryWrapper); - int orderNumber = currentPath.getOrderNumber(); - int size = pathList.size(); - // 逻辑理顺后 将该处转换为while循环形成路径 - if (orderNumber == size) { - // 检测到最后一项 - }else { - // 如果未结束 则使用order_numer + 1获取下一次的坐标,移动机械臂到此位置进行处理 - // 下一坐标的order_number 为 order_numer + 1 - int nextOrderNumber = orderNumber + 1; - QueryWrapper pathQueryWrapper1 = new QueryWrapper<>(); - pathQueryWrapper1.eq("order_number", nextOrderNumber).eq("task_id", taskId); - Path nextPath = pathService.getOne(pathQueryWrapper1); - String coord = nextPath.getCoord(); - // 将该coord转换为机械臂的x y坐标移动 + if (currentPath != null){ + int orderNumber = currentPath.getOrderNumber(); + int size = pathList.size(); + // 逻辑理顺后 将该处转换为while循环形成路径 + if (orderNumber == size) { + // 检测到最后一项 + }else { + // 如果未结束 则使用order_numer + 1获取下一次的坐标,移动机械臂到此位置进行处理 + // 下一坐标的order_number 为 order_numer + 1 + int nextOrderNumber = orderNumber + 1; + QueryWrapper pathQueryWrapper1 = new QueryWrapper<>(); + pathQueryWrapper1.eq("order_number", nextOrderNumber).eq("task_id", taskId); + Path nextPath = pathService.getOne(pathQueryWrapper1); + String coord = nextPath.getCoord(); + // 将该coord转换为机械臂的x y坐标移动 + } } } CheckResult checkResult = new CheckResult(); diff --git a/uploadfiles/xlsx/20230728/template-37.xlsx b/uploadfiles/xlsx/20230728/template-37.xlsx new file mode 100644 index 0000000..1b0a04e Binary files /dev/null and b/uploadfiles/xlsx/20230728/template-37.xlsx differ diff --git a/uploadfiles/xlsx/20230729/template-38.xlsx b/uploadfiles/xlsx/20230729/template-38.xlsx new file mode 100644 index 0000000..1b0a04e Binary files /dev/null and b/uploadfiles/xlsx/20230729/template-38.xlsx differ diff --git a/uploadfiles/xlsx/20230729/template-39.xlsx b/uploadfiles/xlsx/20230729/template-39.xlsx new file mode 100644 index 0000000..1b0a04e Binary files /dev/null and b/uploadfiles/xlsx/20230729/template-39.xlsx differ