|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.jeecg.common.constant.OcrConstant;
|
|
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
|
|
import org.jeecg.common.util.AssertUtils;
|
|
|
|
|
import org.jeecg.modules.ocr.dto.OcrRuleCheckDTO;
|
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrMetadataConfig;
|
|
|
|
@ -57,6 +58,11 @@ public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, Ocr
|
|
|
|
|
public void saveModelBatch(List<SaveOcrRuleCheckVO> saveOcrRuleCheckVOS) {
|
|
|
|
|
for (SaveOcrRuleCheckVO saveOcrRuleCheckVO : saveOcrRuleCheckVOS) {
|
|
|
|
|
OcrRuleCheck ocrRuleCheck=new OcrRuleCheck();
|
|
|
|
|
if (StringUtils.isNotBlank(saveOcrRuleCheckVO.getConfigRule())) {
|
|
|
|
|
if (saveOcrRuleCheckVO.getConfigRule().contains("isrule=1") && saveOcrRuleCheckVO.getConfigRule().replace("isrule=1","").length()>0) {
|
|
|
|
|
throw new JeecgBootException("isrule=1规则只可单独使用");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ocrRuleCheck.setConfigRule(saveOcrRuleCheckVO.getConfigRule());
|
|
|
|
|
ocrRuleCheck.setMetadataConfigId(saveOcrRuleCheckVO.getMetadataConfigId());
|
|
|
|
|
ocrRuleCheck.setConfigName(saveOcrRuleCheckVO.getConfigName());
|
|
|
|
@ -78,20 +84,27 @@ public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, Ocr
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean copy(OcrRuleCheck ocrRuleCheck) {
|
|
|
|
|
String id = ocrRuleCheck.getId();
|
|
|
|
|
OcrRuleCheck ruleCheck = this.getById(id);
|
|
|
|
|
LambdaQueryWrapper<OcrRuleCheck> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
queryWrapper.eq(OcrRuleCheck::getConfigName,ruleCheck.getConfigName());
|
|
|
|
|
long count = this.count(queryWrapper);
|
|
|
|
|
ruleCheck.setId(null);
|
|
|
|
|
ruleCheck.setConfigName(ruleCheck.getConfigName()+"("+(count+1)+")");
|
|
|
|
|
this.save(ruleCheck);
|
|
|
|
|
String ids = ocrRuleCheck.getId();
|
|
|
|
|
for (String id : ids.split(",")) {
|
|
|
|
|
OcrRuleCheck ruleCheck = this.getById(id);
|
|
|
|
|
LambdaQueryWrapper<OcrRuleCheck> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
queryWrapper.eq(OcrRuleCheck::getConfigName,ruleCheck.getConfigName());
|
|
|
|
|
long count = this.count(queryWrapper);
|
|
|
|
|
ruleCheck.setId(null);
|
|
|
|
|
ruleCheck.setConfigName(ruleCheck.getConfigName()+"("+(count+1)+")");
|
|
|
|
|
this.save(ruleCheck);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public OcrRuleCheck updateModel(SaveOcrRuleCheckVO saveOcrRuleCheckVO) {
|
|
|
|
|
OcrRuleCheck ocrRuleCheck=this.getById(saveOcrRuleCheckVO.getId());
|
|
|
|
|
if (StringUtils.isNotBlank(saveOcrRuleCheckVO.getConfigRule())) {
|
|
|
|
|
if (saveOcrRuleCheckVO.getConfigRule().contains("isrule=1") && saveOcrRuleCheckVO.getConfigRule().replace("isrule=1","").length()>0) {
|
|
|
|
|
throw new JeecgBootException("isrule=1规则只可单独使用");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ocrRuleCheck.setConfigRule(saveOcrRuleCheckVO.getConfigRule());
|
|
|
|
|
ocrRuleCheck.setMetadataConfigId(saveOcrRuleCheckVO.getMetadataConfigId());
|
|
|
|
|
ocrRuleCheck.setConfigName(saveOcrRuleCheckVO.getConfigName());
|
|
|
|
|