| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.google.gson.internal.$Gson$Preconditions; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addRemoteUpdateFile(@RequestBody @Validated RemoteUpdateParam param) { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_FILE_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean flag = remoteUpdateService.addRemoteUpdateFile(param.getFilename(), param.getFileType() |
| | | , param.getSoftwareVersion(), param.getHardwareVersion(), param.getAliAddress(), param.getFileLength()); |
| | | return ResponseUtil.success(flag); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | /** |
| | | * 修改固件升级文件名称 |
| | | * |
| | | * @param remoteFileId |
| | | * @param remoteFileName |
| | | * @return |
| | | */ |
| | | @GetMapping("/updateRemoteFileName") |
| | | public ResponseVO<Object> updateRemoteFileName(@RequestParam(required = false, value = "remoteFileId") String remoteFileId, |
| | | @RequestParam(required = false, value = "remoteFileName") String remoteFileName) { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_FILE_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | String result = remoteUpdateService.updateRemoteFileName(remoteFileId, remoteFileName); |
| | | return ResponseUtil.success(result); |
| | | } |
| | | |
| | | @GetMapping("/getRemoteFileList") |
| | | public ResponseVO<Object> getRemoteFileList() { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_FILE_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(remoteUpdateService.getRemoteFileList()); |
| | | } |
| | | |
| | | @GetMapping("/getRemoteUpdateTypeList") |
| | | public ResponseVO<Object> getRemoteUpdateTypeList() { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_TYPE_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(remoteUpdateService.getRemoteUpdateTypeList()); |
| | | } |
| | | |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | //TODO |
| | | @AnonymousAccess |
| | | @PostMapping("/StartRemoteUpdate") |
| | | public ResponseVO<Object> startRemoteUpdate(@RequestBody @Validated RemotePrarm remotePrarm) { |
| | | // if (!permissionConfig.check(MenuEnum.MENU_LIST.getCode())) { |
| | | // return ResponseUtil.fail("缺少对应用户权限"); |
| | | // } |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_START.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | String orderType; |
| | | boolean UpdateFlag = false; |
| | | |
| | |
| | | * @param remotePrarm |
| | | * @return |
| | | */ |
| | | @AnonymousAccess |
| | | @PostMapping("/searchUpdateResult") |
| | | public ResponseVO<Object> searchUpdateResult(@RequestBody RemotePrarm remotePrarm) { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_VERSION.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (remotePrarm.getMac() == null || remotePrarm.getDeviceType() == null) { |
| | | throw new BusinessException("缺少相关参数!"); |
| | | } |
| | |
| | | * @param remotePrarm |
| | | * @return |
| | | */ |
| | | @AnonymousAccess |
| | | @PostMapping("/stopUpdate") |
| | | public ResponseVO<Object> stopUpdate(@RequestBody RemotePrarm remotePrarm) { |
| | | if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_STOP.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (remotePrarm.getMac() == null || remotePrarm.getDeviceType() == null) { |
| | | throw new BusinessException("缺少相关参数!"); |
| | | } |