diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/utils/CallBackWlyUtils.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/utils/CallBackWlyUtils.java index 62aaf5a..346a257 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/utils/CallBackWlyUtils.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/utils/CallBackWlyUtils.java @@ -2,13 +2,11 @@ package org.jeecg.modules.ocr.utils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.util.RestUtil; import org.jeecg.modules.ocr.entity.OcrIdentify; -import org.jeecg.modules.ocr.entity.OcrIdentifyCallbackLog; import org.jeecg.modules.ocr.entity.OcrIdentifyDetail; import org.jeecg.modules.ocr.model.wlycallback.CallBackWlyRequestBody; import org.jeecg.modules.ocr.model.wlycallback.CallBackWlyResult; @@ -17,7 +15,6 @@ import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** @@ -38,16 +35,15 @@ public class CallBackWlyUtils { //成功率 BigDecimal textRateBigd = new BigDecimal(0); //总明细数量 - Integer detail_detailCount = 0; + int detail_detailCount = 0; for (OcrIdentifyDetail identifyDetail : identifyDetails) { List jsonObjects1 = JSONArray.parseArray(identifyDetail.getDataStructured()).toJavaList(JSONObject.class); - if (jsonObjects1 != null) { - //double ocrPrecisionRate = jsonObjects.stream().mapToDouble(o -> o.getDouble("ocrPrecisionRate")).sum(); + if (CollectionUtils.isNotEmpty(jsonObjects1)) { double textRate = jsonObjects.stream().mapToDouble(o->o.getDouble("textRate")).sum(); textRateBigd = textRateBigd.add(new BigDecimal(textRate)); detail_detailCount += jsonObjects1.size(); + jsonObjects.addAll(jsonObjects1); } - jsonObjects.addAll(jsonObjects1); } //组装回调参数