From 8df9a2d73ca1ac716b0496926bdf001b20072d4a Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Wed, 26 Jul 2023 14:52:10 +0800 Subject: [PATCH] updates --- .../ocr/controller/OcrIdentifyController.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/controller/OcrIdentifyController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/controller/OcrIdentifyController.java index 3868c1f..aa86d23 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/controller/OcrIdentifyController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/controller/OcrIdentifyController.java @@ -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 add(@RequestBody OcrIdentify ocrIdentify) { + AssertUtils.notEmpty(ocrIdentify.getTaskName(),"[任务名称]-不可为空"); + AssertUtils.notEmpty(ocrIdentify.getIdentifyUrl(),"[识别路径]不可为空"); + AssertUtils.notEmpty(ocrIdentify.getRuleCheck(),"请选择[规则检查配置]"); + AssertUtils.notEmpty(ocrIdentify.getPriority(),"请选择[优先级]"); //获取识别的图片 List fileList=new ArrayList<>(); List fileUrlList= FileOUtils.fileLists(ocrIdentify.getIdentifyUrl()); @@ -106,6 +111,11 @@ public class OcrIdentifyController extends JeecgController 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 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("删除成功!"); }