fix: 解决bug

pull/166/head
Brian Lee 1 year ago
parent 90f502b84a
commit ffe46fe494

@ -180,7 +180,12 @@ public class FlowTaskController extends BaseController {
return ResultVoUtil.success("审批成功" + success + "条," + "无权审核" + (flowTaskInfoList.size() - success) + "条", "");
}
}
return ResultVoUtil.success("审核成功0条" + "无权审核" + flowTaskInfoList.size() + "条", "");
int noApproveCount = 1;
if (flowTaskInfoList != null){
noApproveCount = flowTaskInfoList.size();
}
return ResultVoUtil.success("审核成功0条" + "无权审核" + noApproveCount + "条", "");
}
@GetMapping("/listhistore")

@ -165,7 +165,7 @@ public class PictureSourceResult {
/**
*
*/
Map<String,Object> manufacturer;
Object manufacturer;
/**
* 访

@ -224,6 +224,8 @@ public class OcrCheckDuplicateServiceImpl extends ServiceImpl<OcrCheckDuplicateM
Map<String, String> compareMap = new HashMap<>();
//定义当前图片比对的最高阈值
BigDecimal maxSimilarity = new BigDecimal("0");
//定义当前图片比对的最低阈值
Map.Entry<String, String> minEntry = null;
//1.1 开始便利进行比对
for (OcrPicture ocrPictureNext : ocrPictureList) {
//排除当前图片,自己跟自己没必要比较
@ -287,7 +289,26 @@ public class OcrCheckDuplicateServiceImpl extends ServiceImpl<OcrCheckDuplicateM
if (b1.compareTo(maxSimilarity) == 1) {
maxSimilarity = b1;
}
//对比结果进行限制取前200条
if(resultMap.size()>=200){
//获取最小阈值
for (Map.Entry<String, String> entry : resultMap.entrySet()) {
BigDecimal currentValue = new BigDecimal(entry.getValue());
if (minEntry == null || currentValue.compareTo(new BigDecimal(minEntry.getValue())) < 0) {
minEntry = entry;
}
}
BigDecimal oldMin = new BigDecimal(minEntry.getValue());
BigDecimal newMin = new BigDecimal(resultValue);
if(oldMin.compareTo(newMin)==-1){
resultMap.remove(minEntry.getKey());
resultMap.put(ocrPictureNext.getId().toString(), resultValue);
minEntry = new AbstractMap.SimpleEntry<>(ocrPictureNext.getId().toString(), resultValue);
}
}else{
resultMap.put(ocrPictureNext.getId().toString(), resultValue);
}
// 判断相似度是否一样
BigDecimal allSimilarity = new BigDecimal("100");
@ -324,9 +345,6 @@ public class OcrCheckDuplicateServiceImpl extends ServiceImpl<OcrCheckDuplicateM
List<OcrPicture> pictures = new ArrayList<>();
pictures.add(ocrPicture);
try {
if ("287798960352200777".equals(ocrPicture.getId()) || "287798960268309961".equals(ocrPicture.getId())) {
System.out.println("adsd");
}
this.saveCheckDuplicateData(checkDuplicateId,saveList,pictures,ocrPictureList.get(0).getTenantId().toString(),sysUser);
} catch (Exception e) {
logger.error("比对结果入库异常! error:{}",e.getMessage());
@ -475,9 +493,22 @@ public class OcrCheckDuplicateServiceImpl extends ServiceImpl<OcrCheckDuplicateM
if (StringUtils.isNotBlank(pictureDuplicateHis.getCheckDuplicateResultHisJson())) {
ObjectMapper hisObjectMapper = new ObjectMapper();
hisMap = hisObjectMapper.readValue(pictureDuplicateHis.getCheckDuplicateResultHisJson(), HashMap.class);
for (String key : newMap.keySet()) {
//开始变更旧map
hisMap.put(key, newMap.get(key));
//检查如果历史比较结果超出范围直接重置历史结果以1000为限制
if(hisMap.size()>1000){
hisMap = newMap;
}else{
newMap.putAll(hisMap);
//倒序排序获取map top200如果有重复则取新值。
hisMap = newMap.entrySet()
.stream()
.sorted((entry1, entry2) -> new BigDecimal(entry2.getValue().toString()).compareTo(new BigDecimal(entry1.getValue().toString())))
.limit(200) // 取前200个
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
(oldValue, newValue) -> newValue,
HashMap::new
));
}
pictureDuplicate.setId(pictureDuplicateHis.getId());
pictureDuplicate.setCheckDuplicateResultHisJson(JSONObject.toJSONString(hisMap));

@ -366,7 +366,10 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
}
Map<String,Object> picturesMap = JSONObject.parseObject(ocrPictureDuplicateHis.getCheckDuplicateResultHisJson());
// 将Map转换成List
List<Map.Entry<String, Integer>> pictureMapList = new ArrayList(picturesMap.entrySet());
List<Map.Entry<String, Integer>> pictureMapList = new ArrayList<>();
for (Map.Entry<String, Object> entry : picturesMap.entrySet()) {
pictureMapList.add(new AbstractMap.SimpleEntry<>(entry.getKey(), Integer.parseInt(entry.getValue().toString())));
}
// 根据Map的值进行排序
pictureMapList.sort(Map.Entry.comparingByValue());
//将排序后的list倒序

@ -196,11 +196,17 @@ public class PictureDisposeTask implements Runnable {
}
//厂商
if (pictureSourceResult.getManufacturer() != null) {
if (pictureSourceResult.getManufacturer().get("name") != null) {
picture.setField5(pictureSourceResult.getManufacturer().get("name").toString());
}
if (pictureSourceResult.getManufacturer() instanceof String) {
// 处理字符串类型的 manufacturer
String manufacturer = (String) pictureSourceResult.getManufacturer();
picture.setField5(manufacturer);
} else if (pictureSourceResult.getManufacturer() instanceof Map) {
// 处理 Map 类型的 manufacturer
Map<String, Object> manufacturer = (Map<String, Object>) pictureSourceResult.getManufacturer();
picture.setField5(manufacturer.get("name").toString());
}
//拜访科室
if (StringUtils.isNotBlank(pictureSourceResult.getCompanyDepartment())) {
picture.setField7(pictureSourceResult.getCompanyDepartment());

Loading…
Cancel
Save