master
周文涛 2 years ago
parent b0d9be39c7
commit 69677d5e8a

@ -21,6 +21,7 @@ import org.jeecg.modules.ocr.utils.ImageUtils;
import org.jeecg.modules.ocr.dto.OcrIdentifyDTO;
import org.jeecg.modules.ocr.dto.OcrRuleCheckDTO;
import org.jeecg.modules.system.service.ISysDictService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.Transactional;
@ -54,12 +55,16 @@ public class ApiController {
private RedisUtil redisUtil;
@Resource
private TaskService taskService;
////===================================================================伪接口
@Value("${spring.profiles.active}")
private String profiles;
@ApiOperation(value = "通用识别")
@RequestMapping("/identify")
@Transactional
@ResponseBody
public Result<?> pushSemantic(@RequestBody JSONObject requestBody) throws InterruptedException {
if (!"test".equals(profiles)) {
return Result.error("当前环境不支持该功能,请访问测试环境");
}
if (requestBody == null) {
return Result.error("请输入请求参数");
}

@ -5,6 +5,7 @@ import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -35,6 +36,7 @@ import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -70,6 +72,9 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
private ISysDictService sysDictService;
@Autowired
private TaskService taskService;
@Value("${spring.profiles.active}")
private String profiles;
/**
*
*
@ -153,6 +158,9 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_identify:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody OcrIdentify ocrIdentify) {
if (!"test".equals(profiles)) {
return Result.error("当前环境不支持该功能,请访问测试环境");
}
AssertUtils.notEmpty(ocrIdentify.getTaskName(), "[任务名称]-不可为空");
AssertUtils.notEmpty(ocrIdentify.getIdentifyUrl(), "[识别路径]不可为空");
AssertUtils.notEmpty(ocrIdentify.getRuleCheck(), "请选择[规则检查配置]");

@ -43,6 +43,8 @@ public class OcrSimulatorController{
private IOcrIdentifyService ocrIdentifyService;
@Resource
private IOcrIdentifyDetailService ocrIdentifyDetailService;
@Value("${spring.profiles.active}")
private String profiles;
@Value("${jeecg.path.upload}")
private String uploadFilePath;
@ -51,6 +53,9 @@ public class OcrSimulatorController{
@ApiOperation(value = "场景识别")
@PostMapping(value = "/identify")
public Result<?> identify(@RequestBody JSONObject requestBody) {
if (!"test".equals(profiles)) {
return Result.error("当前环境不支持该功能,请访问测试环境");
}
JSONObject responseBody = new JSONObject();
JSONArray images = requestBody.getJSONArray("images");
AssertUtils.hasSize(images,"请先上传图片");

Loading…
Cancel
Save