添加图片最大相似值

pull/1/head
sunchenliang 2 years ago
parent 94b2cbec67
commit 4c0df12a73

@ -214,8 +214,16 @@ public class OcrPictureController extends BaseController {
QueryWrapper<OcrPicture> queryWrapper = new QueryWrapper<>();
String search_month = req.getParameter("search_month");
if(StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0){
queryWrapper.ge("create_time",DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
String ordertype = req.getParameter("ordertype");
if (StringUtils.isNotBlank(ordertype)) {
if (ordertype.equals("0")) {
queryWrapper.orderByAsc("similarity_score");
} else {
queryWrapper.orderByDesc("similarity_score");
}
}
if (StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0) {
queryWrapper.ge("create_time", DataUtil.afterDateByMonth(Integer.parseInt(search_month)));
}
//根据参数枚举获取检索参数并映射为数据库的字段的key-v map

@ -306,6 +306,11 @@ public class OcrPicture implements BaseDto, java.io.Serializable {
@TableField(value = "img_hash")
private String imgHash;
@ApiModelProperty(value = "相似度数值")
@Schema(description = "相似度数值")
@TableField(value = "similarity_score")
private Integer similarityscore;
@ApiModelProperty(value = "图片查重的比对图片集合")
@TableField(exist = false)
private List<OcrPicture> listCom;

@ -31,283 +31,287 @@ import java.util.stream.Stream;
import java.util.stream.Collectors;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="任务信息", description="任务信息")
@ApiModel(value = "任务信息", description = "任务信息")
@TableName(value = "ocr_taskchild_picture")
public class OcrTaskchildPicture implements BaseDto,java.io.Serializable {
public class OcrTaskchildPicture implements BaseDto, java.io.Serializable {
private static final long serialVersionUID = -8018660053527763810L;
@ApiModelProperty(value = "主键")
@TableId(value = "id",type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
@TableField(value="ID")
private Long id;
private static final long serialVersionUID = -8018660053527763810L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
@TableField(value = "ID")
private Long id;
@ApiModelProperty(value = "比对图片主键,多个数据使用英文逗号分隔")
@TableField(value="OCPICTUREID")
private String ocpictureid;
@ApiModelProperty(value = "比对图片主键,多个数据使用英文逗号分隔")
@TableField(value = "OCPICTUREID")
private String ocpictureid;
@ApiModelProperty(value = "图片比对结果,与图片主键一一对应记录比对结果使用英文逗号分隔例如99.6,98.1,97.2")
@TableField(value="PICTURERESULT")
private String pictureresult;
@ApiModelProperty(value = "图片比对结果,与图片主键一一对应记录比对结果使用英文逗号分隔例如99.6,98.1,97.2")
@TableField(value = "PICTURERESULT")
private String pictureresult;
@ApiModelProperty(value = "只记录主图,如果存在历史图片,不在这里记录")
@TableField(value="PICTURECOMPARE")
private String picturecompare;
@ApiModelProperty(value = "只记录主图,如果存在历史图片,不在这里记录")
@TableField(value = "PICTURECOMPARE")
private String picturecompare;
@ApiModelProperty(value = "所属部门")
@TableField(value="DEPTID")
private String deptid;
@ApiModelProperty(value = "所属部门")
@TableField(value = "DEPTID")
private String deptid;
@ApiModelProperty(value = "租户ID")
@TableField(value="TENANTID")
private Long tenantid;
@ApiModelProperty(value = "租户ID")
@TableField(value = "TENANTID")
private Long tenantid;
@ApiModelProperty(value = "任务包主键")
@TableField(value="PACKAGEID")
private Long packageid;
@ApiModelProperty(value = "任务包主键")
@TableField(value = "PACKAGEID")
private Long packageid;
@ApiModelProperty(value = "原图片主键")
@TableField(value="PICTUREID")
private Long pictureid;
@ApiModelProperty(value = "原图片主键")
@TableField(value = "PICTUREID")
private Long pictureid;
@ApiModelProperty(value = "类型名称")
@TableField(value="CATEGORY")
private String category;
@ApiModelProperty(value = "类型名称")
@TableField(value = "CATEGORY")
private String category;
@ApiModelProperty(value = "项目ID")
@TableField(value="CATEGORYID")
private Long categoryid;
@ApiModelProperty(value = "项目ID")
@TableField(value = "CATEGORYID")
private Long categoryid;
@ApiModelProperty(value = "明细单")
@TableField(value="SPECIFICATION")
private String specification;
@ApiModelProperty(value = "明细单")
@TableField(value = "SPECIFICATION")
private String specification;
@ApiModelProperty(value = "业务编码")
@TableField(value="BUESSINESSNO")
private String buessinessno;
@ApiModelProperty(value = "业务编码")
@TableField(value = "BUESSINESSNO")
private String buessinessno;
@ApiModelProperty(value = "状态,审批状态 1:未提交 2:审批中 3:审批通过 5拒绝")
@TableField(value="STATES")
private Integer states;
@ApiModelProperty(value = "状态,审批状态 1:未提交 2:审批中 3:审批通过 5拒绝")
@TableField(value = "STATES")
private Integer states;
@ApiModelProperty(value = "流程实例IdprocessInstanceId")
@TableField(value="PROCESSINSTANCEID")
private String processinstanceid;
@ApiModelProperty(value = "流程定义id")
@TableField(value="PROCESSDEFINITIONID")
private String processdefinitionid;
@ApiModelProperty(value = "流程部署id")
@TableField(value="DEPLOYMENTID")
private String deploymentid;
@ApiModelProperty(value = "审批人姓名")
@TableField(value="ASSIGNEENAME")
private String assigneename;
@ApiModelProperty(value = "审批人")
@TableField(value="ASSIGNEE")
private String assignee;
@ApiModelProperty(value = "修改人,记录创建人的帐号")
@TableField(value="UPDATEUSER")
private String updateuser;
@ApiModelProperty(value = "更新时间")
@TableField(value="UPDATETIME")
private Long updatetime;
@ApiModelProperty(value = "附件")
@TableField(value="FILEANNEX")
private String fileannex;
@ApiModelProperty(value = "是否归档0未归档1归档")
@TableField(value="GUIDANG")
private Integer guidang;
@ApiModelProperty(value = "创建人")
@TableField(value="CREATEUSER")
private String createuser;
@ApiModelProperty(value = "创建人姓名")
@TableField(value="CREATEUSERNAME")
private String createusername;
@ApiModelProperty(value = "创建时间")
@TableField(value="CREATEDATE")
private Long createdate;
@ApiModelProperty(value = "员工主键")
@TableField(value="USERID")
private Long userid;
@ApiModelProperty(value = "员工姓名")
@TableField(value="USERNAME")
private String username;
@ApiModelProperty(value = "任务id,来源于图片表")
@TableField(value="FROMTASKID")
private String fromtaskid;
@ApiModelProperty(value = "任务名称,来源于图片表")
@TableField(value="FROMTASKNAME")
private String fromtaskname;
@ApiModelProperty(value = "提报人")
@TableField(value="FROMUSERID")
private String fromuserid;
@ApiModelProperty(value = "所属项目")
@TableField(value="FROMPROJECTID")
private String fromprojectid;
@ApiModelProperty(value = "所属计划")
@TableField(value="FROMPLANID")
private String fromplanid;
@ApiModelProperty(value = "提报时间")
@TableField(value="FROMUPTIME")
private Long fromuptime;
@ApiModelProperty(value = "任务来源")
@TableField(value="FROMSOURCEID")
private String fromsourceid;
@ApiModelProperty(value = "是否为相似图片与其他图片对比为百分百的记录为10不相似1相似")
@TableField(value="HAVEPOINTS")
private Integer havepoints;
@Schema(description = "当前节点名称")
@TableField(value="TASKNAME")
private String taskname;
@ApiModelProperty(value = "项目对象")
@TableField(exist = false)
private Category categoryDto;
@ApiModelProperty(value = "节点主键")
@TableField(exist = false)
private String taskId;
//节点描述
@ApiModelProperty(value = "节点描述")
@TableField(exist = false)
private String documentation;
// 关联 任务的流程记录
@ApiModelProperty(value = "审批记录")
@TableField(exist = false)
private List<HistoricTaskInstanceDto> transferRecords;
@ApiModelProperty(value = "是否为历史图片true是历史图片false非历史图片")
@TableField(exist = false)
private boolean izHistory;
@ApiModelProperty(value ="图片真假 0:假1其他表示没有设置")
@TableField(exist = false)
private Integer iztrueorfalse;
@ApiModelProperty(value ="是否已经审批0未审批1审批中2已审批")
@TableField(exist = false)
private String workStatus;
@ApiModelProperty(value ="图片对象")
@TableField(exist = false)
private OcrPicture ocrPicture;
@ApiModelProperty(value ="提报时间")
@TableField(exist = false)
private String reporttime;
@ApiModelProperty(value ="本人审查日志")
@TableField(exist = false)
private Userapprove userapprove;
@ApiModelProperty(value ="审查日志")
@TableField(exist = false)
private List<Userapprove> userapproveList;
//保存当前登录用户的数据权限范围的搜索条件
@TableField(exist = false)
@JsonIgnore
private SearchQuery searchQueryrolesShowleave;
public FlowModelVO getFlowModelVO(){
FlowModelVO flowModelVO = new FlowModelVO();
flowModelVO.setFormid(this.getId());
flowModelVO.setAssignee(this.getAssignee());
flowModelVO.setAssigneename(this.getAssigneename());
flowModelVO.setProcessdefinitionid(this.getProcessdefinitionid());
flowModelVO.setUserid(this.getUserid());
flowModelVO.setUsername(this.getUsername());
flowModelVO.setCategoryid(this.getCategoryid());
flowModelVO.setStates(this.getStates());
flowModelVO.setDeploymentid(this.getDeploymentid());
flowModelVO.setCreateuser(this.getCreateuser());
flowModelVO.setCreatedate(this.getCreatedate());
flowModelVO.setProcessInstanceId(this.getProcessdefinitionid());
flowModelVO.setGuidang(this.getGuidang());
flowModelVO.setFileannex(this.getFileannex());
flowModelVO.setCreateusername(this.getCreateusername());
flowModelVO.setProcessInstanceId(this.getProcessinstanceid());
flowModelVO.setTenantid(this.getTenantid());
flowModelVO.setTaskId(this.getTaskId());
return flowModelVO;
}
@TableField(exist = false)
@JsonIgnore
private final Map<String,String> query = Stream.of(
new SimpleEntry<>("ID","id"),
new SimpleEntry<>("OCPICTUREID","ocpictureid"),
new SimpleEntry<>("PICTURERESULT","pictureresult"),
new SimpleEntry<>("PICTURECOMPARE","picturecompare"),
new SimpleEntry<>("DEPTID","deptid"),
new SimpleEntry<>("TENANTID","tenantid"),
new SimpleEntry<>("PACKAGEID","packageid"),
new SimpleEntry<>("PICTUREID","pictureid"),
new SimpleEntry<>("CATEGORY","category"),
new SimpleEntry<>("CATEGORYID","categoryid"),
new SimpleEntry<>("SPECIFICATION","specification"),
new SimpleEntry<>("BUESSINESSNO","buessinessno"),
new SimpleEntry<>("STATES","states"),
new SimpleEntry<>("PROCESSINSTANCEID","processinstanceid"),
new SimpleEntry<>("PROCESSDEFINITIONID","processdefinitionid"),
new SimpleEntry<>("DEPLOYMENTID","deploymentid"),
new SimpleEntry<>("ASSIGNEENAME","assigneename"),
new SimpleEntry<>("ASSIGNEE","assignee"),
new SimpleEntry<>("UPDATEUSER","updateuser"),
new SimpleEntry<>("UPDATETIME","updatetime"),
new SimpleEntry<>("FILEANNEX","fileannex"),
new SimpleEntry<>("GUIDANG","guidang"),
new SimpleEntry<>("CREATEUSER","createuser"),
new SimpleEntry<>("CREATEUSERNAME","createusername"),
new SimpleEntry<>("CREATEDATE","createdate"),
new SimpleEntry<>("USERID","userid"),
new SimpleEntry<>("USERNAME","username"),
new SimpleEntry<>("FROMTASKID","fromtaskid"),
new SimpleEntry<>("FROMTASKNAME","fromtaskname"),
new SimpleEntry<>("FROMUSERID","fromuserid"),
new SimpleEntry<>("FROMPROJECTID","fromprojectid"),
new SimpleEntry<>("FROMPLANID","fromplanid"),
new SimpleEntry<>("FROMUPTIME","fromuptime"),
new SimpleEntry<>("FROMSOURCEID","fromsourceid"),
new SimpleEntry<>("HAVEPOINTS","havepoints"),
new SimpleEntry<>("TASKNAME","taskname")
)
.collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue));
@Override
public String getQueryFiled(String filedname){
String obj = null;
if(null != query && query.size() > 0){
obj = query.get(filedname);
}
return obj;
}
@ApiModelProperty(value = "流程实例IdprocessInstanceId")
@TableField(value = "PROCESSINSTANCEID")
private String processinstanceid;
@ApiModelProperty(value = "流程定义id")
@TableField(value = "PROCESSDEFINITIONID")
private String processdefinitionid;
@ApiModelProperty(value = "流程部署id")
@TableField(value = "DEPLOYMENTID")
private String deploymentid;
@ApiModelProperty(value = "审批人姓名")
@TableField(value = "ASSIGNEENAME")
private String assigneename;
@ApiModelProperty(value = "审批人")
@TableField(value = "ASSIGNEE")
private String assignee;
@ApiModelProperty(value = "修改人,记录创建人的帐号")
@TableField(value = "UPDATEUSER")
private String updateuser;
@ApiModelProperty(value = "更新时间")
@TableField(value = "UPDATETIME")
private Long updatetime;
@ApiModelProperty(value = "附件")
@TableField(value = "FILEANNEX")
private String fileannex;
@ApiModelProperty(value = "是否归档0未归档1归档")
@TableField(value = "GUIDANG")
private Integer guidang;
@ApiModelProperty(value = "创建人")
@TableField(value = "CREATEUSER")
private String createuser;
@ApiModelProperty(value = "创建人姓名")
@TableField(value = "CREATEUSERNAME")
private String createusername;
@ApiModelProperty(value = "创建时间")
@TableField(value = "CREATEDATE")
private Long createdate;
@ApiModelProperty(value = "员工主键")
@TableField(value = "USERID")
private Long userid;
@ApiModelProperty(value = "员工姓名")
@TableField(value = "USERNAME")
private String username;
@ApiModelProperty(value = "任务id,来源于图片表")
@TableField(value = "FROMTASKID")
private String fromtaskid;
@ApiModelProperty(value = "任务名称,来源于图片表")
@TableField(value = "FROMTASKNAME")
private String fromtaskname;
@ApiModelProperty(value = "提报人")
@TableField(value = "FROMUSERID")
private String fromuserid;
@ApiModelProperty(value = "所属项目")
@TableField(value = "FROMPROJECTID")
private String fromprojectid;
@ApiModelProperty(value = "所属计划")
@TableField(value = "FROMPLANID")
private String fromplanid;
@ApiModelProperty(value = "提报时间")
@TableField(value = "FROMUPTIME")
private Long fromuptime;
@ApiModelProperty(value = "任务来源")
@TableField(value = "FROMSOURCEID")
private String fromsourceid;
@ApiModelProperty(value = "是否为相似图片与其他图片对比为百分百的记录为10不相似1相似")
@TableField(value = "HAVEPOINTS")
private Integer havepoints;
@Schema(description = "当前节点名称")
@TableField(value = "TASKNAME")
private String taskname;
@ApiModelProperty(value = "项目对象")
@TableField(exist = false)
private Category categoryDto;
@ApiModelProperty(value = "节点主键")
@TableField(exist = false)
private String taskId;
//节点描述
@ApiModelProperty(value = "节点描述")
@TableField(exist = false)
private String documentation;
// 关联 任务的流程记录
@ApiModelProperty(value = "审批记录")
@TableField(exist = false)
private List<HistoricTaskInstanceDto> transferRecords;
@ApiModelProperty(value = "是否为历史图片true是历史图片false非历史图片")
@TableField(exist = false)
private boolean izHistory;
@ApiModelProperty(value = "图片真假 0:假1其他表示没有设置")
@TableField(exist = false)
private Integer iztrueorfalse;
@ApiModelProperty(value = "是否已经审批0未审批1审批中2已审批")
@TableField(exist = false)
private String workStatus;
@ApiModelProperty(value = "图片对象")
@TableField(exist = false)
private OcrPicture ocrPicture;
@ApiModelProperty(value = "提报时间")
@TableField(exist = false)
private String reporttime;
@ApiModelProperty(value = "相似度数值")
@TableField(exist = false)
private Integer similarityscore;
@ApiModelProperty(value = "本人审查日志")
@TableField(exist = false)
private Userapprove userapprove;
@ApiModelProperty(value = "审查日志")
@TableField(exist = false)
private List<Userapprove> userapproveList;
//保存当前登录用户的数据权限范围的搜索条件
@TableField(exist = false)
@JsonIgnore
private SearchQuery searchQueryrolesShowleave;
public FlowModelVO getFlowModelVO() {
FlowModelVO flowModelVO = new FlowModelVO();
flowModelVO.setFormid(this.getId());
flowModelVO.setAssignee(this.getAssignee());
flowModelVO.setAssigneename(this.getAssigneename());
flowModelVO.setProcessdefinitionid(this.getProcessdefinitionid());
flowModelVO.setUserid(this.getUserid());
flowModelVO.setUsername(this.getUsername());
flowModelVO.setCategoryid(this.getCategoryid());
flowModelVO.setStates(this.getStates());
flowModelVO.setDeploymentid(this.getDeploymentid());
flowModelVO.setCreateuser(this.getCreateuser());
flowModelVO.setCreatedate(this.getCreatedate());
flowModelVO.setProcessInstanceId(this.getProcessdefinitionid());
flowModelVO.setGuidang(this.getGuidang());
flowModelVO.setFileannex(this.getFileannex());
flowModelVO.setCreateusername(this.getCreateusername());
flowModelVO.setProcessInstanceId(this.getProcessinstanceid());
flowModelVO.setTenantid(this.getTenantid());
flowModelVO.setTaskId(this.getTaskId());
return flowModelVO;
}
@TableField(exist = false)
@JsonIgnore
private final Map<String, String> query = Stream.of(
new SimpleEntry<>("ID", "id"),
new SimpleEntry<>("OCPICTUREID", "ocpictureid"),
new SimpleEntry<>("PICTURERESULT", "pictureresult"),
new SimpleEntry<>("PICTURECOMPARE", "picturecompare"),
new SimpleEntry<>("DEPTID", "deptid"),
new SimpleEntry<>("TENANTID", "tenantid"),
new SimpleEntry<>("PACKAGEID", "packageid"),
new SimpleEntry<>("PICTUREID", "pictureid"),
new SimpleEntry<>("CATEGORY", "category"),
new SimpleEntry<>("CATEGORYID", "categoryid"),
new SimpleEntry<>("SPECIFICATION", "specification"),
new SimpleEntry<>("BUESSINESSNO", "buessinessno"),
new SimpleEntry<>("STATES", "states"),
new SimpleEntry<>("PROCESSINSTANCEID", "processinstanceid"),
new SimpleEntry<>("PROCESSDEFINITIONID", "processdefinitionid"),
new SimpleEntry<>("DEPLOYMENTID", "deploymentid"),
new SimpleEntry<>("ASSIGNEENAME", "assigneename"),
new SimpleEntry<>("ASSIGNEE", "assignee"),
new SimpleEntry<>("UPDATEUSER", "updateuser"),
new SimpleEntry<>("UPDATETIME", "updatetime"),
new SimpleEntry<>("FILEANNEX", "fileannex"),
new SimpleEntry<>("GUIDANG", "guidang"),
new SimpleEntry<>("CREATEUSER", "createuser"),
new SimpleEntry<>("CREATEUSERNAME", "createusername"),
new SimpleEntry<>("CREATEDATE", "createdate"),
new SimpleEntry<>("USERID", "userid"),
new SimpleEntry<>("USERNAME", "username"),
new SimpleEntry<>("FROMTASKID", "fromtaskid"),
new SimpleEntry<>("FROMTASKNAME", "fromtaskname"),
new SimpleEntry<>("FROMUSERID", "fromuserid"),
new SimpleEntry<>("FROMPROJECTID", "fromprojectid"),
new SimpleEntry<>("FROMPLANID", "fromplanid"),
new SimpleEntry<>("FROMUPTIME", "fromuptime"),
new SimpleEntry<>("FROMSOURCEID", "fromsourceid"),
new SimpleEntry<>("HAVEPOINTS", "havepoints"),
new SimpleEntry<>("TASKNAME", "taskname")
)
.collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue));
@Override
public String getQueryFiled(String filedname) {
String obj = null;
if (null != query && query.size() > 0) {
obj = query.get(filedname);
}
return obj;
}
}

@ -82,6 +82,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
@Resource
private OcrPictureclassService ocrPictureclassService;
@Resource
private CategoryService categoryService;
@ -323,25 +324,25 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
//分类不一致的也不需要进行比对
//TODO 接口请求判断重复情况
logService.addLog(103, "AI获取图片相似度接口", sysUser, "sendParams");
if(StringUtils.isBlank(ocrPicture.getImgHash())){
Map<String,String> map = this.getOcrPictureClassifyAndHash(ocrPicture.getLocalpictrueurl());
if(map!=null){
if (StringUtils.isBlank(ocrPicture.getImgHash())) {
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPicture.getLocalpictrueurl());
if (map != null) {
ocrPicture.setImgHash(map.get("hash"));
ocrPicture.setClassificationid(map.get("classId"));
}
this.updateById(ocrPicture);
}
if(StringUtils.isBlank(ocrPictureNext.getImgHash())){
Map<String,String> map = this.getOcrPictureClassifyAndHash(ocrPictureNext.getLocalpictrueurl());
if(map!=null){
if (StringUtils.isBlank(ocrPictureNext.getImgHash())) {
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPictureNext.getLocalpictrueurl());
if (map != null) {
ocrPictureNext.setImgHash(map.get("hash"));
ocrPictureNext.setClassificationid(map.get("classId"));
}
this.updateById(ocrPictureNext);
}
String img=StringUtils.isBlank(ocrPicture.getImgHash())?StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPicture.getImgurl() : ocrPicture.getLocalpictrueurl():ocrPicture.getImgHash();
String imgNext=StringUtils.isBlank(ocrPictureNext.getImgHash())?StringUtils.isBlank(ocrPictureNext.getLocalpictrueurl()) ? ocrPictureNext.getImgurl() : ocrPictureNext.getLocalpictrueurl():ocrPictureNext.getImgHash();
String img = StringUtils.isBlank(ocrPicture.getImgHash()) ? StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPicture.getImgurl() : ocrPicture.getLocalpictrueurl() : ocrPicture.getImgHash();
String imgNext = StringUtils.isBlank(ocrPictureNext.getImgHash()) ? StringUtils.isBlank(ocrPictureNext.getLocalpictrueurl()) ? ocrPictureNext.getImgurl() : ocrPictureNext.getLocalpictrueurl() : ocrPictureNext.getImgHash();
String resultValue = HashCompareUtil.cmpHash(img, imgNext);
ocrPictureNext.setResult(resultValue);
@ -403,15 +404,15 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
@Override
public Map<String, String> getOcrPictureClassifyAndHash(String img) {
JSONObject jsonObjectSimi = ImageClassUtil.getClassify(img,"1",classifyPath);
JSONObject jsonObjectSimi = ImageClassUtil.getClassify(img, "1", classifyPath);
//返回内容为零,表示成功,否则表示失败
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0") && jsonObjectSimi.get("data")!=null&&jsonObjectSimi.getJSONArray("data").size()>0) {
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0") && jsonObjectSimi.get("data") != null && jsonObjectSimi.getJSONArray("data").size() > 0) {
JSONObject data = jsonObjectSimi.getJSONArray("data").getJSONObject(0);
Map<String,String> map=new HashMap();
map.put("classId",data.getString("classId"));
map.put("hash",data.getString("hash"));
Map<String, String> map = new HashMap();
map.put("classId", data.getString("classId"));
map.put("hash", data.getString("hash"));
return map;
}else{
} else {
return null;
}
}
@ -427,7 +428,13 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
ocrTaskchildPicture.setPackageid(packageid);
StringBuffer pcid = new StringBuffer();
StringBuffer result = new StringBuffer();
int max = 0;
for (OcrPicture comp : ocrPicture.getListCom()) {
double doubleValue = Double.parseDouble(comp.getResult());
int intValue = (int) doubleValue;
if (intValue > max) {
max = intValue;
}
if (null == pcid || pcid.toString().length() < 1) {
pcid.append(comp.getId());
result.append(comp.getResult());
@ -439,6 +446,8 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
ocrTaskchildPicture.setOcpictureid(pcid.toString());
ocrTaskchildPicture.setPictureresult(result.toString());
ocrTaskchildPicture.setPicturecompare(String.join(",", ocrPicture.getPicturecompareList()));
ocrPicture.setSimilarityscore(max);
this.updateById(ocrPicture);
return ocrTaskchildPictureService.updateById(ocrTaskchildPicture) ? ocrTaskchildPicture : null;
}

@ -167,7 +167,7 @@
</where>
</sql>
<select id="listFinal" resultType="cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture" parameterType="java.util.Map">
select tcp.*,pic.field11 reporttime from (
select tcp.*,pic.field11 reporttime,pic.similarity_score similarityscore from (
select
tc.*
from ocr_taskchild_picture tc,OA_USERFINAL_T uf

Loading…
Cancel
Save