修改部分API注释bug
This commit is contained in:
EnderByEndera
2024-01-13 10:23:48 +08:00
parent 135a1ae04c
commit ee10a17aea
32 changed files with 201 additions and 173 deletions

View File

@@ -35,7 +35,7 @@ public class ProjectObjectDataListener implements ReadListener<ProtectObject> {
private void saveData() {
Boolean success = protectObjectService.newProtectObjects(cachedDataList);
if (!success) {
throw new RuntimeException("Error reading data in /proobj/new");
throw new RuntimeException("在/proobj/upload中读取数据时出现了错误");
}
}
}

View File

@@ -46,7 +46,7 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
@Override
@PostMapping("/upload")
public ResponseResult uploadFile(
@NotNull(message = "uploadFile cannot be null. ") MultipartFile uploadFile
@NotNull(message = "uploadFile字段不能为空") MultipartFile uploadFile
) throws IOException {
EasyExcel.read(uploadFile.getInputStream(), ProtectObject.class,
new ProjectObjectDataListener(protectObjectService)).sheet().doRead();
@@ -85,6 +85,10 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
@GetMapping("/{protectObjectId}/query")
public ResponseResult queryProtectObject(@PathVariable Integer protectObjectId) throws IllegalAccessException {
ProtectObject protectObject = protectObjectService.queryProtectObject(protectObjectId);
if (protectObject == null) {
return ResponseResult.invalid()
.setMessage("无效的防护对象ID也许该ID指定的防护对象不存在");
}
return ResponseResult.ok()
.setDataMap(EntityUtils.entityToMap(protectObject));
}

View File

@@ -53,7 +53,7 @@ public interface ProtectObjectControllerApi {
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "上传文件")
)
ResponseResult uploadFile(
@NotNull(message = "uploadFile cannot be null. ") MultipartFile uploadFile
@NotNull(message = "uploadFile字段不能为空") MultipartFile uploadFile
) throws IOException;
@GetMapping("/download")

View File

@@ -102,7 +102,7 @@ public class ProtectObjectService {
public Map<String, Object> changeProtectObjectAuditStatus(Integer protectObjectId, Integer auditStatus) {
Integer originalAuditStatus = protectObjectMapper.queryProtectObject(protectObjectId).getProtectObjectAuditStatus();
if (!AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(auditStatus)) {
throw new IllegalArgumentException("invalid audit status");
throw new IllegalArgumentException("无效的审核状态");
}
Boolean success = protectObjectMapper.changeProtectObjectAuditStatus(protectObjectId, auditStatus);

View File

@@ -53,7 +53,7 @@ public class TemplateController implements TemplateControllerApi {
Template template = templateService.queryTemplate(templateId);
if (template == null) {
return ResponseResult.invalid()
.setMessage("invalid templateId, maybe this template doesn't exist?");
.setMessage("无效的策略模板ID也许该模板不存在");
}
return ResponseResult.ok()
.setDataMap(EntityUtils.entityToMap(template));