权限修改,app相关接口修改

This commit is contained in:
2026-01-18 14:55:35 +08:00
parent e6b68bff8c
commit d3f4b6a700
4 changed files with 37 additions and 16 deletions

View File

@@ -90,6 +90,7 @@ public class AjaxResult extends HashMap<String, Object>
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*

View File

@@ -36,7 +36,7 @@ public AjaxResult getImageBase64(String path) {
// 返回base64数据格式为 data:image/xxx;base64,xxxxx
String result = "data:" + mimeType + ";base64," + base64String;
return AjaxResult.success(result);
return AjaxResult.success("操作成功",result);
} catch (Exception e) {
return AjaxResult.error("读取图片失败: " + e.getMessage());
}

View File

@@ -8,23 +8,43 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
//文字识别
@RestController
@RequestMapping("/ocr")
public class OrcController {
@PostMapping
public AjaxResult orcSheepNo(String path) {
// 添加空值检查
if (path == null || path.trim().isEmpty()) {
return AjaxResult.error("路径不能为空");
}
@PostMapping
public AjaxResult orcSheepNo(String path) {
// 添加空值检查
if (path == null || path.trim().isEmpty()) {
return AjaxResult.error("路径不能为空");
}
try {
OcrRecognizeUtil ocrRecognizeUtil = new OcrRecognizeUtil();
// 移除 /profile
path = path.replace("/profile", "");
path = RuoYiConfig.getProfile() + path;
String recognize =ocrRecognizeUtil.recognizeTwo(path);
return AjaxResult.success(recognize);
// 验证文件是否存在
File file = new File(path);
if (!file.exists()) {
return AjaxResult.error("文件不存在: " + path);
}
if (!file.isFile()) {
return AjaxResult.error("路径不是一个有效文件: " + path);
}
if (!file.canRead()) {
return AjaxResult.error("无权限读取文件: " + path);
}
String recognize = ocrRecognizeUtil.recognizeTwo(path);
return AjaxResult.success("操作成功", recognize);
} catch (Exception e) {
return AjaxResult.error("OCR识别失败: " + e.getMessage());
}
}
}

View File

@@ -37,7 +37,7 @@ public class DdFsController extends BaseController
/**
* 查询冻精库存列表
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:list')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:list')")
@GetMapping("/list")
public TableDataInfo list(DdFs ddFs)
{
@@ -49,7 +49,7 @@ public class DdFsController extends BaseController
/**
* 导出冻精库存列表
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:export')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:export')")
@Log(title = "冻精库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DdFs ddFs)
@@ -62,7 +62,7 @@ public class DdFsController extends BaseController
/**
* 获取冻精库存详细信息
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:query')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@@ -72,7 +72,7 @@ public class DdFsController extends BaseController
/**
* 新增冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:add')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:add')")
@Log(title = "冻精库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DdFs ddFs)
@@ -83,7 +83,7 @@ public class DdFsController extends BaseController
/**
* 修改冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:edit')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:edit')")
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DdFs ddFs)
@@ -94,7 +94,7 @@ public class DdFsController extends BaseController
/**
* 删除冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:remove')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:remove')")
@Log(title = "冻精库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
@@ -105,7 +105,7 @@ public class DdFsController extends BaseController
/**
* 批量废弃
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:discard')")
@PreAuthorize("@ss.hasPermi('frozen:sperm:discard')")
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
@PutMapping("/discard")
public AjaxResult discard(@RequestBody List<DdFs> list) {