diff --git a/yudao-module-remote/yudao-module-remote-biz/pom.xml b/yudao-module-remote/yudao-module-remote-biz/pom.xml index 5b8592197..d3aee38af 100644 --- a/yudao-module-remote/yudao-module-remote-biz/pom.xml +++ b/yudao-module-remote/yudao-module-remote-biz/pom.xml @@ -38,15 +38,6 @@ ${revision} - - org.springframework.integration - spring-integration-mqtt - - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - - io.swagger.core.v3 swagger-annotations @@ -62,6 +53,25 @@ spring-cloud-starter-openfeign + + + cn.iocoder.cloud + yudao-spring-boot-starter-biz-data-permission + + + cn.iocoder.cloud + yudao-spring-boot-starter-biz-tenant + + + cn.iocoder.cloud + yudao-spring-boot-starter-biz-ip + + + + + cn.iocoder.cloud + yudao-spring-boot-starter-security + org.springframework.boot diff --git a/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/controller/login/LoginController.java b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/controller/login/LoginController.java new file mode 100644 index 000000000..f9154a715 --- /dev/null +++ b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/controller/login/LoginController.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.remote.controller.login; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.remote.service.login.LoginService; +import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + + +@Tag(name = "管理后台 - 远遥登录") +@RestController +@RequestMapping("/remote/login") +@Validated +public class LoginController { + + @Resource + private LoginService loginService; + + @PostMapping("/check") + @Operation(summary = "测试通讯") + @PermitAll + public CommonResult checkCommunication(@Valid @RequestBody LoginCheckDTO loginCheckDTO) { + return success(loginService.checkCommunication(loginCheckDTO)); + } + + +} \ No newline at end of file diff --git a/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/framework/security/config/SecurityConfiguration.java b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/framework/security/config/SecurityConfiguration.java new file mode 100644 index 000000000..465b2696a --- /dev/null +++ b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/framework/security/config/SecurityConfiguration.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.remote.framework.security.config; + +import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer; +import cn.iocoder.yudao.module.system.enums.ApiConstants; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; + +/** + * System 模块的 Security 配置 + */ +@Configuration(proxyBeanMethods = false, value = "systemSecurityConfiguration") +public class SecurityConfiguration { + + @Bean("systemAuthorizeRequestsCustomizer") + public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { + return new AuthorizeRequestsCustomizer() { + + @Override + public void customize(AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry registry) { + // TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案 + // Swagger 接口文档 + registry.requestMatchers("/v3/api-docs/**").permitAll() + .requestMatchers("/webjars/**").permitAll() + .requestMatchers("/swagger-ui").permitAll() + .requestMatchers("/swagger-ui/**").permitAll(); + // Druid 监控 + registry.requestMatchers("/druid/**").permitAll(); + // Spring Boot Actuator 的安全配置 + registry.requestMatchers("/actuator").permitAll() + .requestMatchers("/actuator/**").permitAll(); + // RPC 服务的安全配置 + registry.requestMatchers(ApiConstants.PREFIX + "/**").permitAll(); + } + + }; + } + +} diff --git a/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginService.java b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginService.java new file mode 100644 index 000000000..62c2029f0 --- /dev/null +++ b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginService.java @@ -0,0 +1,7 @@ +package cn.iocoder.yudao.module.remote.service.login; + +import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO; + +public interface LoginService { + Boolean checkCommunication(LoginCheckDTO loginCheckDTO); +} diff --git a/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginServiceImpl.java b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginServiceImpl.java new file mode 100644 index 000000000..c4007aac5 --- /dev/null +++ b/yudao-module-remote/yudao-module-remote-biz/src/main/java/cn/iocoder/yudao/module/remote/service/login/LoginServiceImpl.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.remote.service.login; + +import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + + +@Slf4j +@Service +public class LoginServiceImpl implements LoginService{ + + + /*@Resource + private RemoteLoginApi remoteLoginApi;*/ + + private String checkUrl = "/system/remote/controller-information/checkAddress"; + + /** + * 测试通讯 + * @param loginCheckDTO + * @return + */ + @Override + public Boolean checkCommunication(LoginCheckDTO loginCheckDTO) { + RestTemplate restTemplate = new RestTemplate(); + String url = loginCheckDTO.getMailAddress()+"/"+loginCheckDTO.getPort()+checkUrl; + String str = restTemplate.getForObject(url, String.class); + System.out.println("结果 :"+str); + return true; + } +} diff --git a/yudao-module-remote/yudao-module-remote-biz/src/main/resources/application.yaml b/yudao-module-remote/yudao-module-remote-biz/src/main/resources/application.yaml index d6365ccf1..8c790a54a 100644 --- a/yudao-module-remote/yudao-module-remote-biz/src/main/resources/application.yaml +++ b/yudao-module-remote/yudao-module-remote-biz/src/main/resources/application.yaml @@ -42,6 +42,64 @@ knife4j: setting: language: zh_cn +yudao: + info: + version: 1.0.0 + base-package: cn.iocoder.yudao.module.remote + web: + admin-ui: + url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 + swagger: + title: 管理后台 + description: 提供管理员管理的所有功能 + version: ${yudao.info.version} + tenant: # 多租户相关配置项 + enable: true + ignore-urls: + - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 + - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 + - /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关 + - /admin-api/system/captcha/get # 获取图片验证码,和租户无关 + - /admin-api/system/captcha/check # 校验图片验证码,和租户无关 + - /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号 + - /rpc-api/system/tenant/valid # 防止递归。避免调用 /rpc-api/system/tenant/valid 接口时,又去触发 /rpc-api/system/tenant/valid 去校验 + - /rpc-api/system/tenant/id-list # 获得租户列表的时候,无需传递租户编号 + - /rpc-api/system/oauth2/token/check # 访问令牌校验时,无需传递租户编号;主要解决上传文件的场景,前端不会传递 tenant-id! + ignore-tables: + - system_tenant + - system_tenant_package + - system_dict_data + - system_dict_type + - system_error_code + - system_menu + - system_sms_channel + - system_sms_template + - system_sms_log + - system_sensitive_word + - system_oauth2_client + - system_mail_account + - system_mail_template + - system_mail_log + - system_notify_template + ignore-caches: + - user_role_ids + - permission_menu_ids + - oauth_client + - notify_template + - mail_account + - mail_template + - sms_template + sms-code: # 短信验证码相关的配置项 + expire-times: 10m + send-frequency: 1m + send-maximum-quantity-per-day: 10 + begin-code: 9999 # 这里配置 9999 的原因是,测试方便。 + end-code: 9999 # 这里配置 9999 的原因是,测试方便。 + debug: false diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApi.java new file mode 100644 index 000000000..eabd9c6f8 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApi.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.system.api.remote; + +import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO; +import cn.iocoder.yudao.module.system.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory = +@Tag(name = "RPC 服务 - 远遥登录相关的服务调用") +public interface RemoteLoginApi { + String PREFIX = ApiConstants.PREFIX + "/remote"; + + @PostMapping(PREFIX + "/checkCommunication") + @Operation(summary = "路径规划需要初始化信息") + Boolean checkCommunication(@RequestBody LoginCheckDTO loginCheckDTO); +} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/dto/LoginCheckDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/dto/LoginCheckDTO.java new file mode 100644 index 000000000..52f82a449 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/remote/dto/LoginCheckDTO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.api.remote.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class LoginCheckDTO { + @Schema(description = "通讯地址") + private String mailAddress; + + @Schema(description = "通讯端口") + private String port; +} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 8c2cdda0d..b3ef90448 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -270,4 +270,6 @@ public interface ErrorCodeConstants { ErrorCode TASK_PROCEED_NOT_EXISTS = new ErrorCode(1_002_051_001, "车辆衔接任务不存在"); // ========== 车辆(地图)急停记录 1_002_052_001 ========== ErrorCode MAP_STOP_NOT_EXISTS = new ErrorCode(1_002_052_001, "车辆(地图)急停记录不存在"); + // ========== 远遥设备信息 1_002_053_001 ========== + ErrorCode CONTROLLER_INFORMATION_NOT_EXISTS = new ErrorCode(1_002_053_001, "远遥设备信息不存在"); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApiImpl.java new file mode 100644 index 000000000..b5526f674 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/remote/RemoteLoginApiImpl.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.system.api.remote; + +import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController // 提供 RESTful API 接口,给 Feign 调用 +@Validated +public class RemoteLoginApiImpl implements RemoteLoginApi{ + + @Override + public Boolean checkCommunication(LoginCheckDTO loginCheckDTO) { + return null; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotTaskStatusApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotTaskStatusApiImpl.java index f40a6a40f..a7c6ef2b7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotTaskStatusApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotTaskStatusApiImpl.java @@ -120,7 +120,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi { String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + robotCompleteTaskDTO.getMac(); if (ObjectUtil.isEmpty(robotCompleteTaskDTO.getOrderId())) { - log.info("没有任务id :{}",JSON.toJSONString(robotCompleteTaskDTO)); + log.info("没有任务id :{}", JSON.toJSONString(robotCompleteTaskDTO)); return; } @@ -278,6 +278,20 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi { // taskService.closeTaskDetail(robotCompleteTaskDTO.getOrderId().toString(),robotCompleteTaskDTO.getMac()); String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac()); + String msg = ""; + if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType()) + || PathTaskTypeEnum.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())) { + RobotTaskDetailDO robotTaskDetailDO = robotTaskDetailMapper.selectById(robotCompleteTaskDTO.getOrderId()); + if (RobotTaskStageEnum.GO_TAKE.getType().equals(robotTaskDetailDO.getTaskStage()) + || RobotTaskStageEnum.UN_START.getType().equals(robotTaskDetailDO.getTaskStage())) { + robotTaskDetailDO.setTaskStatus(RobotTaskDetailStatusEnum.NEW.getType()); + robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.UN_START.getType()); + robotTaskDetailDO.setRobotNo(""); + robotTaskDetailMapper.updateById(robotTaskDetailDO); + String taskNo = taskDetailService.getTaskNoByDetailId(robotCompleteTaskDTO.getOrderId()); + msg = robotNo + "_" + "车辆发生异常,重新分配其他车辆执行此任务" + taskNo; + } + } //先不释放库位状态 /*if (RobotTaksOrderTypeEnum.TASK.getType().equals(robotCompleteTaskDTO.getOrderType())) { RobotTaskDetailDO robotTaskDetailDO = closeTaskDetail(robotCompleteTaskDTO.getOrderId()); @@ -309,16 +323,19 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi { String solve = ""; if (!PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType()) - && !PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) { + && !PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()) + && ObjectUtil.isEmpty(msg)) { String taskNo = taskDetailService.getTaskNoByDetailId(robotCompleteTaskDTO.getOrderId()); solve = " 并且到任务列表关闭任务 " + taskNo; } + msg = ObjectUtil.isEmpty(msg) ? robotNo + "_" + robotCompleteTaskDTO.getMessage() : msg; + RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(4) .warnCode(robotCompleteTaskDTO.getStatusCode()) .robotNo(robotNo) .warnType(RobotWarnType.ROBOT_WARN.getType()) - .warnMsg(robotNo + "_" + robotCompleteTaskDTO.getMessage()) + .warnMsg(msg) .warnSolve(robotCompleteTaskDTO.getSolution() + solve) .build(); warnMsgMapper.insert(warnMsg); @@ -547,7 +564,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi { @Override public void robotDoneTask(RobotCompleteTaskDTO robotCompleteTaskDTO) { taskExecutor.execute(() -> { - String requestId = UUID.randomUUID().toString().replace("-","");; + String requestId = UUID.randomUUID().toString().replace("-", ""); + ; MDC.put(CommonConstant.REQUEST_ID, requestId); try { doRobotDoneTask(robotCompleteTaskDTO); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/RemoteControllerInformationController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/RemoteControllerInformationController.java new file mode 100644 index 000000000..c5d754f26 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/RemoteControllerInformationController.java @@ -0,0 +1,108 @@ +package cn.iocoder.yudao.module.system.controller.admin.remote; + +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationRespVO; +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInformationDO; +import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.annotation.security.PermitAll; +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 远遥设备信息") +@RestController +@RequestMapping("/system/remote/controller-information") //不能修改/删除 +@Validated +public class RemoteControllerInformationController { + + @Resource + private RemoteControllerInformationService controllerInformationService; + + @PostMapping("/create") + @Operation(summary = "创建远遥设备信息") + @PreAuthorize("@ss.hasPermission('remote:controller-information:create')") + public CommonResult createControllerInformation(@Valid @RequestBody RemoteControllerInformationSaveReqVO createReqVO) { + return success(controllerInformationService.createControllerInformation(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新远遥设备信息") + @PreAuthorize("@ss.hasPermission('remote:controller-information:update')") + public CommonResult updateControllerInformation(@Valid @RequestBody RemoteControllerInformationSaveReqVO updateReqVO) { + controllerInformationService.updateControllerInformation(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除远遥设备信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('remote:controller-information:delete')") + public CommonResult deleteControllerInformation(@RequestParam("id") Long id) { + controllerInformationService.deleteControllerInformation(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得远遥设备信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('remote:controller-information:query')") + public CommonResult getControllerInformation(@RequestParam("id") Long id) { + RemoteControllerInformationDO controllerInformation = controllerInformationService.getControllerInformation(id); + return success(BeanUtils.toBean(controllerInformation, RemoteControllerInformationRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得远遥设备信息分页") + @PreAuthorize("@ss.hasPermission('remote:controller-information:query')") + public CommonResult> getControllerInformationPage(@Valid RemoteControllerInformationPageReqVO pageReqVO) { + PageResult pageResult = controllerInformationService.getControllerInformationPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, RemoteControllerInformationRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出远遥设备信息 Excel") + @PreAuthorize("@ss.hasPermission('remote:controller-information:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportControllerInformationExcel(@Valid RemoteControllerInformationPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = controllerInformationService.getControllerInformationPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "远遥设备信息.xls", "数据", RemoteControllerInformationRespVO.class, + BeanUtils.toBean(list, RemoteControllerInformationRespVO.class)); + } + + /** + * 不能修改/删除 + * @return + */ + @PostMapping("/checkAddress") + @Operation(summary = "校验远遥的地址") + @PermitAll + public CommonResult checkAddress() { + return success("连接"); + } +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationPageReqVO.java new file mode 100644 index 000000000..ead954dca --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationPageReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.admin.remote.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 远遥设备信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class RemoteControllerInformationPageReqVO extends PageParam { + + @Schema(description = "远遥的设备IP") + private String remoteIp; + + @Schema(description = "AGV编号") + private String robotNo; + + @Schema(description = "远遥模式(0:自动模式, 1:手动模式, 2:自由模式)") + private Integer remoteMode; + + @Schema(description = "协控(0:关闭协控, 1:开启协控)") + private Integer collaborativeControl; + + @Schema(description = "远遥的其他信息") + private String remoteMsg; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationRespVO.java new file mode 100644 index 000000000..eaf1e2c2f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationRespVO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.controller.admin.remote.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 远遥设备信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RemoteControllerInformationRespVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26526") + @ExcelProperty("主键ID") + private Long id; + + @Schema(description = "远遥的设备IP") + @ExcelProperty("远遥的设备IP") + private String remoteIp; + + @Schema(description = "AGV编号") + @ExcelProperty("AGV编号") + private String robotNo; + + @Schema(description = "远遥模式(0:自动模式, 1:手动模式, 2:自由模式)") + @ExcelProperty("远遥模式(0:自动模式, 1:手动模式, 2:自由模式)") + private Integer remoteMode; + + @Schema(description = "协控(0:关闭协控, 1:开启协控)") + @ExcelProperty("协控(0:关闭协控, 1:开启协控)") + private Integer collaborativeControl; + + @Schema(description = "远遥的其他信息") + @ExcelProperty("远遥的其他信息") + private String remoteMsg; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationSaveReqVO.java new file mode 100644 index 000000000..2ddea93b6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/remote/vo/RemoteControllerInformationSaveReqVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.controller.admin.remote.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 远遥设备信息新增/修改 Request VO") +@Data +public class RemoteControllerInformationSaveReqVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26526") + private Long id; + + @Schema(description = "远遥的设备IP") + private String remoteIp; + + @Schema(description = "AGV编号") + private String robotNo; + + @Schema(description = "远遥模式(0:自动模式, 1:手动模式, 2:自由模式)") + private Integer remoteMode; + + @Schema(description = "协控(0:关闭协控, 1:开启协控)") + private Integer collaborativeControl; + + @Schema(description = "远遥的其他信息") + private String remoteMsg; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/robot/RobotChargeLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/robot/RobotChargeLogController.java index 2001e9b4d..7c8f2aee0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/robot/RobotChargeLogController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/robot/RobotChargeLogController.java @@ -31,7 +31,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; @Tag(name = "管理后台 - 车辆充电记录") @RestController -@RequestMapping("/robot/charge-log") +@RequestMapping("/system/robot/charge-log") @Validated public class RobotChargeLogController { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/remote/RemoteControllerInformationDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/remote/RemoteControllerInformationDO.java new file mode 100644 index 000000000..0f33ecddc --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/remote/RemoteControllerInformationDO.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.remote; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 远遥设备信息 DO + * + * @author 陈宾顺 + */ +@TableName("remote_controller_information") +@KeySequence("remote_controller_information_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RemoteControllerInformationDO extends BaseDO { + + /** + * 主键ID + */ + @TableId + private Long id; + /** + * 远遥的设备IP + */ + private String remoteIp; + /** + * AGV编号 + */ + private String robotNo; + /** + * 远遥模式(0:自动模式, 1:手动模式, 2:自由模式) + */ + private Integer remoteMode; + /** + * 协控(0:关闭协控, 1:开启协控) + */ + private Integer collaborativeControl; + /** + * 远遥的其他信息 + */ + private String remoteMsg; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/robot/RobotMapStopDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/robot/RobotMapStopDO.java index 056717d27..db40847b0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/robot/RobotMapStopDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/robot/RobotMapStopDO.java @@ -22,7 +22,7 @@ public class RobotMapStopDO extends BaseDO { /** * 主键ID */ - @TableId + @TableId(type = IdType.ASSIGN_ID) private Long id; /** * 急停仓库点位地图表id diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java new file mode 100644 index 000000000..e24900db4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.dal.mysql.remote; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInformationDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 远遥设备信息 Mapper + * + * @author 陈宾顺 + */ +@Mapper +public interface RemoteControllerInformationMapper extends BaseMapperX { + + default PageResult selectPage(RemoteControllerInformationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(RemoteControllerInformationDO::getRemoteIp, reqVO.getRemoteIp()) + .eqIfPresent(RemoteControllerInformationDO::getRobotNo, reqVO.getRobotNo()) + .eqIfPresent(RemoteControllerInformationDO::getRemoteMode, reqVO.getRemoteMode()) + .eqIfPresent(RemoteControllerInformationDO::getCollaborativeControl, reqVO.getCollaborativeControl()) + .eqIfPresent(RemoteControllerInformationDO::getRemoteMsg, reqVO.getRemoteMsg()) + .betweenIfPresent(RemoteControllerInformationDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(RemoteControllerInformationDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationService.java new file mode 100644 index 000000000..2f59705f5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationService.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.service.remote; + +import java.util.*; +import javax.validation.*; + +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInformationDO; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 远遥设备信息 Service 接口 + * + * @author 陈宾顺 + */ +public interface RemoteControllerInformationService extends IService { + + /** + * 创建远遥设备信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createControllerInformation(@Valid RemoteControllerInformationSaveReqVO createReqVO); + + /** + * 更新远遥设备信息 + * + * @param updateReqVO 更新信息 + */ + void updateControllerInformation(@Valid RemoteControllerInformationSaveReqVO updateReqVO); + + /** + * 删除远遥设备信息 + * + * @param id 编号 + */ + void deleteControllerInformation(Long id); + + /** + * 获得远遥设备信息 + * + * @param id 编号 + * @return 远遥设备信息 + */ + RemoteControllerInformationDO getControllerInformation(Long id); + + /** + * 获得远遥设备信息分页 + * + * @param pageReqVO 分页查询 + * @return 远遥设备信息分页 + */ + PageResult getControllerInformationPage(RemoteControllerInformationPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java new file mode 100644 index 000000000..d4611f6d5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.system.service.remote; + +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInformationDO; +import cn.iocoder.yudao.module.system.dal.mysql.remote.RemoteControllerInformationMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.CONTROLLER_INFORMATION_NOT_EXISTS; + +/** + * 远遥设备信息 Service 实现类 + * + * @author 陈宾顺 + */ +@Service +@Validated +public class RemoteControllerInformationServiceImpl extends ServiceImpl implements RemoteControllerInformationService { + + @Resource + private RemoteControllerInformationMapper controllerInformationMapper; + + @Override + public Long createControllerInformation(RemoteControllerInformationSaveReqVO createReqVO) { + // 插入 + RemoteControllerInformationDO controllerInformation = BeanUtils.toBean(createReqVO, RemoteControllerInformationDO.class); + controllerInformationMapper.insert(controllerInformation); + // 返回 + return controllerInformation.getId(); + } + + @Override + public void updateControllerInformation(RemoteControllerInformationSaveReqVO updateReqVO) { + // 校验存在 + validateControllerInformationExists(updateReqVO.getId()); + // 更新 + RemoteControllerInformationDO updateObj = BeanUtils.toBean(updateReqVO, RemoteControllerInformationDO.class); + controllerInformationMapper.updateById(updateObj); + } + + @Override + public void deleteControllerInformation(Long id) { + // 校验存在 + validateControllerInformationExists(id); + // 删除 + controllerInformationMapper.deleteById(id); + } + + private void validateControllerInformationExists(Long id) { + if (controllerInformationMapper.selectById(id) == null) { + throw exception(CONTROLLER_INFORMATION_NOT_EXISTS); + } + } + + @Override + public RemoteControllerInformationDO getControllerInformation(Long id) { + return controllerInformationMapper.selectById(id); + } + + @Override + public PageResult getControllerInformationPage(RemoteControllerInformationPageReqVO pageReqVO) { + return controllerInformationMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml new file mode 100644 index 000000000..9ba3fcddb --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file