| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid VoRtuProgram vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@Parameter(description = "form表单数据", required = true) @Valid VoRtuProgram vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | if(vo.file == null){ |
| | | return BaseResponseUtils.buildFail("RTU程序文件必须上传") ; |
| | | } |
| | | String fileName = vo.file.getOriginalFilename() ; |
| | | if(this.sv.existFileName(fileName)){ |
| | | return BaseResponseUtils.buildFail("RTU程序文件名已存在") ; |
| | | } |
| | | |
| | | HexFileVo fileVo = null ; |
| | |
| | | } |
| | | if(fileVo != null){ |
| | | UgRtuProgram po = new UgRtuProgram(); |
| | | po.hexFileName = vo.file.getOriginalFilename() ; |
| | | po.hexFileName = fileName ; |
| | | po.programCalculateBytes = (int)fileVo.calculateBytes ; |
| | | po.programCrc16 = fileVo.bytesCrc16 ; |
| | | po.programBytes = fileVo.bytes; |