master
周文涛 2 years ago
parent 6e829fc65a
commit 8df9a2d73c

@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.OcrConstant;
import org.jeecg.common.constant.enums.OcrStatusEnum;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -77,6 +78,10 @@ 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) {
AssertUtils.notEmpty(ocrIdentify.getTaskName(),"[任务名称]-不可为空");
AssertUtils.notEmpty(ocrIdentify.getIdentifyUrl(),"[识别路径]不可为空");
AssertUtils.notEmpty(ocrIdentify.getRuleCheck(),"请选择[规则检查配置]");
AssertUtils.notEmpty(ocrIdentify.getPriority(),"请选择[优先级]");
//获取识别的图片
List<String> fileList=new ArrayList<>();
List<String> fileUrlList= FileOUtils.fileLists(ocrIdentify.getIdentifyUrl());
@ -106,6 +111,11 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_identify:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody OcrIdentify ocrIdentify) {
AssertUtils.notEmpty(ocrIdentify.getId(),"[id]不可为空");
OcrIdentify identify = ocrIdentifyService.getById(ocrIdentify.getId());
if ("0".equals(identify.getStatus()) || "1".equals(identify.getStatus())) {
throw new JeecgBootException("当前状态不可编辑");
}
ocrIdentifyService.updateById(ocrIdentify);
return Result.OK("编辑成功!");
}
@ -122,7 +132,7 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
OcrIdentify ocrIdentify = ocrIdentifyService.getById(id);
AssertUtils.isTrue(OcrStatusEnum.OVER.getStatus().equals(ocrIdentify.getStatus()),"当前ocr识别状态不可删除");
AssertUtils.isTrue(OcrStatusEnum.OVER.getStatus().equals(ocrIdentify.getStatus()),"当前状态不可删除");
ocrIdentifyService.removeById(id);
return Result.OK("删除成功!");
}

Loading…
Cancel
Save