代码修改

release
xuliangwei 2 years ago
parent ac0b615c9a
commit 883931566d
  1. 29
      dxhy-erp/src/main/java/com/dxhy/erp/service/impl/RequestRecordServiceImpl.java

@ -146,32 +146,37 @@ public class RequestRecordServiceImpl extends MpBaseServiceImpl<RequestRecordDao
log.info("重调后得到的结果:{}",JSONObject.toJSONString(invokeResponse));
JSONObject rspJson = JSONObject.parseObject(JSONObject.toJSONString(invokeResponse), JSONObject.class);
JSONObject rspJson = JSONObject.parseObject(invokeResponse.toString(), JSONObject.class);
log.info("重调后返回信息:{}",rspJson);
data.put("data", invokeResponse);
if (rspJson.containsKey("SAPKEY")) {
if (!rspJson.containsKey("处理成功")) {
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(invokeResponse), JSONObject.toJSONString(data), rspJson.getString("ZMESSAGE"), 0);
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(rspJson), JSONObject.toJSONString(data), rspJson.getString("ZMESSAGE"), 0);
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
}
if (rspJson.containsKey("code")) {
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(invokeResponse), JSONObject.toJSONString(data), rspJson.getString("message"), 0);
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(rspJson), JSONObject.toJSONString(data), rspJson.getString("message"), 0);
return ResponseEntity.ok(JSONObject.toJSONString(data));
} else {
if (rspJson.containsKey("cyjg")) {
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(invokeResponse), JSONObject.toJSONString(data), rspJson.getString("cyjgxx"), 0);
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(rspJson), JSONObject.toJSONString(data), rspJson.getString("cyjgxx"), 0);
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
}
updateSuccessfulRecallRecord(dbRecord, 0, JSONObject.toJSONString(invokeResponse), JSONObject.toJSONString(data));
updateSuccessfulRecallRecord(dbRecord, 0, JSONObject.toJSONString(rspJson), JSONObject.toJSONString(data));
return ResponseEntity.ok(JSONObject.toJSONString(data));
}catch (Exception e) {
log.info("重调出现异常,异常信息:{}",e);
log.error("重调出现异常,异常信息:{}",e.getMessage());
try {
updateFailedRecallRecord(dbRecord, 1, JSONObject.toJSONString(invokeResponse),
JSONObject.toJSONString(data), "重调用出现异常:"+JSONObject.toJSONString(e.getMessage()), 0);
} catch (Exception exception) {
log.error("接口重调用保存异常:{}",exception.getMessage());
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)));
}
@ -208,13 +213,19 @@ public class RequestRecordServiceImpl extends MpBaseServiceImpl<RequestRecordDao
}
private void setResponse(RequestRecord record, String activeCallRecallResponse, String recallResponseDetail) {
HashMap<String, String> activeCallrecallMap = JSONObject.parseObject(record.getRecallResponseDetail(),HashMap.class);
HashMap<String, String> reCallMap = JSONObject.parseObject(record.getRecallResponseDetail(),HashMap.class);
if (record.getRetryTimes() == 0) {
HashMap<String, String> activeCallrecallMap = new LinkedHashMap<>();
activeCallrecallMap = new HashMap<>();
reCallMap = new HashMap<>();
activeCallrecallMap.put("第1次主动调用重调返回结果", activeCallRecallResponse);
record.setActiveCallRecallResponse(JSONObject.toJSONString(activeCallrecallMap));
activeCallrecallMap.put("第1次重调返回结果", recallResponseDetail);
} else {
JSONObject.parseObject(record.getRecallResponseDetail(),LinkedHashMap.class).put("第"+ record.getRetryTimes() + 1+"次重调结果", recallResponseDetail);
reCallMap.put("第"+ record.getRetryTimes() + 1+"次重调结果", recallResponseDetail);
activeCallrecallMap.put("第"+ record.getRetryTimes() + 1+"次主动调用重调结果", activeCallRecallResponse);
}
record.setActiveCallRecallResponse(JSONObject.toJSONString(activeCallrecallMap));
record.setRecallResponseDetail(JSONObject.toJSONString(reCallMap));
}

Loading…
Cancel
Save