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

@ -8,7 +8,7 @@
WHERE c.num <#{autoPushNoticeMaxNum} WHERE c.num <#{autoPushNoticeMaxNum}
</select> </select>
<select id="findIdentifyIdGroupGtCount" resultType="java.lang.String"> <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 GROUP BY identify_id)c
WHERE c.num &gt;#{autoPushNoticeMaxNum} WHERE c.num &gt;#{autoPushNoticeMaxNum}
</select> </select>

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

Loading…
Cancel
Save