master
周文涛 2 years ago
parent 72f4f7bbea
commit 5056094b68

@ -8,7 +8,7 @@
WHERE c.num <#{autoPushNoticeMaxNum}
</select>
<select id="findIdentifyIdGroupGtCount" resultType="java.lang.String">
SELECT c.identify_id FROM (SELECT count(id)as num,identify_id FROM ocr_identify_callback_log where state='0'
SELECT c.identify_id FROM (SELECT count(id)as num,identify_id FROM ocr_identify_callback_log where status=0
GROUP BY identify_id)c
WHERE c.num &gt;#{autoPushNoticeMaxNum}
</select>

@ -425,9 +425,14 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
@Override
public void callbackWly(String ocrIdentifyId){
OcrIdentifyCallbackLog ocrIdentifyCallbackLog=new OcrIdentifyCallbackLog();
ocrIdentifyCallbackLog.setIdentifyId(ocrIdentifyId);
Date date = new Date();
ocrIdentifyCallbackLog.setCreateTime(date);
LambdaUpdateWrapper<OcrIdentify> updateWrapper = new LambdaUpdateWrapper<OcrIdentify>();
updateWrapper.eq(OcrIdentify::getId, ocrIdentifyId);
long time = new Date().getTime();
long time = date.getTime();
//回调 无量云接口
OcrIdentify ocrIdentify = super.getById(ocrIdentifyId);
if (ocrIdentify!=null) {
@ -475,6 +480,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
log.info("请求无量云回调接口");
JSONObject semanticResponseJson = null;
try {
ocrIdentifyCallbackLog.setStartTime(new Date());
semanticResponseJson = RestUtil.post("https://192.168.1.21:8686/api/task/image/ocr/callback", requestBody);
} catch (org.springframework.web.client.ResourceAccessException e){
log.error("请求无量云回调接口失败-拒绝连接 (Connection refused)");
@ -484,17 +490,22 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
e.printStackTrace();
} finally {
log.info("回调返回------------------");
ocrIdentifyCallbackLog.setEndTime(new Date());
if (semanticResponseJson != null) {
log.info(semanticResponseJson.toJSONString());
updateWrapper.set(OcrIdentify::getNoticeStatus, "1");
super.update(updateWrapper);
ocrIdentifyCallbackLog.setStatus(1);
} else {
log.info("回调返回-----:null");
ocrIdentifyCallbackLog.setStatus(0);
}
}
}
}
ocrIdentifyCallbackLogService.save(ocrIdentifyCallbackLog);
}
}

Loading…
Cancel
Save