fix(ocr): 完善

This commit is contained in:
yjz
2024-07-19 10:17:21 +08:00
parent 56cf824ca5
commit 0a4fa5da08
6 changed files with 113 additions and 4 deletions
@@ -32,13 +32,33 @@ public class OcrRecordEO extends BaseEntity implements Serializable{
private String spendTime; private String spendTime;
//转换结果 //转换结果
private String resultContent; private String resultContent;
public String getResultContentDictText() {
return resultContentDictText;
}
public void setResultContentDictText(String resultContentDictText) {
this.resultContentDictText = resultContentDictText;
}
//转换结果 翻译
private String resultContentDictText;
//新增字段 //新增字段
private String fileType; private String fileType;
//文件类型 翻译
private String fileTypeDictText;
private String standNumber; private String standNumber;
private String standName; private String standName;
private String creationUser; private String creationUser;
private String attId; private String attId;
private String wordAttId; private String wordAttId;
public String getFileTypeDictText() {
return fileTypeDictText;
}
public void setFileTypeDictText(String fileTypeDictText) {
this.fileTypeDictText = fileTypeDictText;
}
public String getJsonAttId() { public String getJsonAttId() {
return jsonAttId; return jsonAttId;
@@ -71,6 +71,13 @@
<if test="modifyTime2 != null" > <if test="modifyTime2 != null" >
and modify_time &lt;= #{modifyTime2} and modify_time &lt;= #{modifyTime2}
</if> </if>
<if test="resultContent != null and resultContent != ''" >
and result_content = #{resultContent}
</if>
<if test="standardNumberAndName != null and orderCondition != ''" >
and (stand_number like concat('%',#{standardNumberAndName},'%')
or stand_name like concat('%',#{standardNumberAndName},'%'))
</if>
</trim> </trim>
</sql> </sql>
@@ -20,6 +20,37 @@ public class BasePage {
private String q; private String q;
@TableField(exist = false) @TableField(exist = false)
private Pager pager = new Pager(); private Pager pager = new Pager();
@TableField(exist = false)
private String standardNumberAndName;
@TableField(exist = false)
private String resultContent;
@TableField(exist = false)
private String orderCondition;
public String getOrderCondition() {
return orderCondition;
}
public void setOrderCondition(String orderCondition) {
this.orderCondition = orderCondition;
}
public String getStandardNumberAndName() {
return standardNumberAndName;
}
public void setStandardNumberAndName(String standardNumberAndName) {
this.standardNumberAndName = standardNumberAndName;
}
public String getResultContent() {
return resultContent;
}
public void setResultContent(String resultContent) {
this.resultContent = resultContent;
}
public BasePage() { public BasePage() {
} }
@@ -37,6 +37,36 @@ public class OcrRecordEOPage extends BasePage {
private String shunxu; private String shunxu;
private String sql; private String sql;
private String standardNumberAndName;
private String resultContent;
private String orderCondition;
@Override
public String getOrderCondition() {
return orderCondition;
}
@Override
public void setOrderCondition(String orderCondition) {
this.orderCondition = orderCondition;
}
public String getStandardNumberAndName() {
return standardNumberAndName;
}
public void setStandardNumberAndName(String standardNumberAndName) {
this.standardNumberAndName = standardNumberAndName;
}
public String getResultContent() {
return resultContent;
}
public void setResultContent(String resultContent) {
this.resultContent = resultContent;
}
public String getWordFileCode() { public String getWordFileCode() {
return this.wordFileCode; return this.wordFileCode;
} }
@@ -115,7 +115,8 @@ public class OCRRestfulServiceImpl implements OCRRestfulService {
ocrRecordEO.setCreationUser(sysUser.getId()); ocrRecordEO.setCreationUser(sysUser.getId());
ocrRecordEO.setFileName(fileName); ocrRecordEO.setFileName(fileName);
ocrRecordEO.setCreationTime(new Date()); ocrRecordEO.setCreationTime(new Date());
ocrRecordEO.setResultContent("转换中"); // ocrRecordEO.setResultContent("转换中");
ocrRecordEO.setResultContent("1");
ocrRecordEO.setStandNumber(getOcrEO.getStandNumber()); ocrRecordEO.setStandNumber(getOcrEO.getStandNumber());
ocrRecordEO.setStandName(getOcrEO.getStandName()); ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType()); ocrRecordEO.setFileType(getOcrEO.getFileType());
@@ -126,7 +127,8 @@ public class OCRRestfulServiceImpl implements OCRRestfulService {
OcrRecordEO ocrRecordEO = new OcrRecordEO(); OcrRecordEO ocrRecordEO = new OcrRecordEO();
ocrRecordEO.setId(taskId); ocrRecordEO.setId(taskId);
ocrRecordEO.setFileName(fileName); ocrRecordEO.setFileName(fileName);
ocrRecordEO.setResultContent("转换中"); // ocrRecordEO.setResultContent("转换中");
ocrRecordEO.setResultContent("1");
ocrRecordEO.setStandNumber(getOcrEO.getStandNumber()); ocrRecordEO.setStandNumber(getOcrEO.getStandNumber());
ocrRecordEO.setStandName(getOcrEO.getStandName()); ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType()); ocrRecordEO.setFileType(getOcrEO.getFileType());
@@ -187,7 +189,8 @@ public class OCRRestfulServiceImpl implements OCRRestfulService {
ocrRecordEO.setJsonRealName(jsonFile.getOriginalFilename()); ocrRecordEO.setJsonRealName(jsonFile.getOriginalFilename());
ocrRecordEO.setJsonFileCode(null); ocrRecordEO.setJsonFileCode(null);
ocrRecordEO.setModifyTime(new Date()); ocrRecordEO.setModifyTime(new Date());
ocrRecordEO.setResultContent("转换成功"); // ocrRecordEO.setResultContent("转换成功");
ocrRecordEO.setResultContent("2");
ocrRecordEO.setWordAttId(wordId); ocrRecordEO.setWordAttId(wordId);
ocrRecordEO.setJsonAttId(jsonId); ocrRecordEO.setJsonAttId(jsonId);
ocrRecordEOMapper.updateByPrimaryKeySelective(ocrRecordEO); ocrRecordEOMapper.updateByPrimaryKeySelective(ocrRecordEO);
@@ -4,6 +4,8 @@ import com.jero.modules.laws.ocr.mapper.OcrRecordEOMapper;
import com.jero.modules.laws.ocr.entity.OcrRecordEO; import com.jero.modules.laws.ocr.entity.OcrRecordEO;
import com.jero.modules.laws.ocr.page.OcrRecordEOPage; import com.jero.modules.laws.ocr.page.OcrRecordEOPage;
import com.jero.modules.laws.ocr.service.OcrRecordEOService; import com.jero.modules.laws.ocr.service.OcrRecordEOService;
import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -20,10 +22,26 @@ public class OcrRecordEOServiceImpl implements OcrRecordEOService {
@Autowired @Autowired
private OcrRecordEOMapper ocrRecordEOMapper; private OcrRecordEOMapper ocrRecordEOMapper;
@Autowired
private ISysDictService sysDictService;
@Override @Override
public List<OcrRecordEO> queryByPage(OcrRecordEOPage page) { public List<OcrRecordEO> queryByPage(OcrRecordEOPage page) {
return ocrRecordEOMapper.queryByPage(page); List<OcrRecordEO> ocrRecordEOS = ocrRecordEOMapper.queryByPage(page);
// 翻译
for (OcrRecordEO ocrRecordEO : ocrRecordEOS) {
String transitionStatus =
sysDictService.queryDictTextByKey("transition_status", ocrRecordEO.getResultContent());
if (StringUtils.isNotBlank(transitionStatus)){
ocrRecordEO.setResultContentDictText(transitionStatus);
}
String processManuscript =
sysDictService.queryDictTextByKey("process_manuscript", ocrRecordEO.getFileType());
if (StringUtils.isNotBlank(processManuscript)){
ocrRecordEO.setFileTypeDictText(processManuscript);
}
}
return ocrRecordEOS;
} }
@Override @Override