修改请求记录日志打印,记录查询接口修改,添加fi848接口请求记录保存

release
xuliangwei 2 years ago
parent 3f129e2510
commit 9a902b1d2a
  1. 44
      dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java
  2. 10
      dxhy-erp/src/main/java/com/dxhy/erp/controller/RequestRecallController.java
  3. 63
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  4. 10
      dxhy-erp/src/main/java/com/dxhy/erp/dao/RequestRecordDao.java
  5. 4
      dxhy-erp/src/main/java/com/dxhy/erp/service/RequestRecordService.java
  6. 23
      dxhy-erp/src/main/java/com/dxhy/erp/service/impl/RequestRecordServiceImpl.java
  7. 62
      dxhy-erp/src/main/resources/mapper/RequestRecordMapper.xml

@ -1170,6 +1170,14 @@ public class InterfaceController extends AbstractController {
OutPut outPut = new OutPut(); OutPut outPut = new OutPut();
String zdata = requestParam.getIS_INPUT().getZDATA(); String zdata = requestParam.getIS_INPUT().getZDATA();
List<VoucherRecord> voucherRecords = JSON.parseArray(zdata, VoucherRecord.class); List<VoucherRecord> voucherRecords = JSON.parseArray(zdata, VoucherRecord.class);
RequestRecord insertVouncherRecordRequestRecord = requestRecordService.getBaseRequestRecord(JSONObject.toJSONString(requestParam), "/po", "insertVouncherRecord");
List<String> bzdhs = new ArrayList<>();
if (!CollectionUtils.isEmpty(voucherRecords)) {
voucherRecords.forEach(voucherRecord -> bzdhs.add(voucherRecord.getZbzdh()));
insertVouncherRecordRequestRecord.setBzdh(JSONObject.toJSONString(bzdhs));
}
DynamicContextHolder.push("business"+ DbConstant.BUSINESS_READ); DynamicContextHolder.push("business"+ DbConstant.BUSINESS_READ);
try{ try{
boolean b = voucherRecordService.addVoucherRecords(voucherRecords); boolean b = voucherRecordService.addVoucherRecords(voucherRecords);
@ -1184,6 +1192,19 @@ public class InterfaceController extends AbstractController {
esOutPutResp.setZMESSAGE("处理失败"); esOutPutResp.setZMESSAGE("处理失败");
} }
outPut.setES_OUTPUT(esOutPutResp); outPut.setES_OUTPUT(esOutPutResp);
try {
DynamicContextHolder.push("business"+ DbConstant.BUSINESS_WRITE);
if (b) {
requestRecordService.saveSuccessfulRequestRecord(insertVouncherRecordRequestRecord, JSONObject.toJSONString(outPut));
} else {
requestRecordService.saveFailedRequestRecord(insertVouncherRecordRequestRecord, 0, JSONObject.toJSONString(outPut), "处理失败");
}
} catch (Exception e) {
log.error("fi848接口请求记录保存失败,错误信息:{}",e);
}
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
@ -1193,6 +1214,14 @@ public class InterfaceController extends AbstractController {
esOutPutResp.setZTYPE("E"); esOutPutResp.setZTYPE("E");
esOutPutResp.setZMESSAGE("程序内部错误"); esOutPutResp.setZMESSAGE("程序内部错误");
outPut.setES_OUTPUT(esOutPutResp); outPut.setES_OUTPUT(esOutPutResp);
try {
DynamicContextHolder.push("business"+ DbConstant.BUSINESS_WRITE);
requestRecordService.saveFailedRequestRecord(insertVouncherRecordRequestRecord, 1, JSONObject.toJSONString(outPut), JSONObject.toJSONString(e));
} catch (Exception exception) {
log.error("fi848接口请求记录保存失败,错误信息:{}",e);
}
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);
} }
@ -1229,8 +1258,7 @@ public class InterfaceController extends AbstractController {
requestRecordService.saveSuccessfulRequestRecord(receiveErpInvoiceMessageRecord, JsonUtils.getInstance().toJsonString(outPut)); requestRecordService.saveSuccessfulRequestRecord(receiveErpInvoiceMessageRecord, JsonUtils.getInstance().toJsonString(outPut));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("FI847接口记录保存失败,errormsg:{}",e.getMessage()); log.error("FI847接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);
@ -1249,8 +1277,7 @@ public class InterfaceController extends AbstractController {
requestRecordService.saveFailedRequestRecord(receiveErpInvoiceMessageRecord, 1, JsonUtils.getInstance().toJsonString(outPut), requestRecordService.saveFailedRequestRecord(receiveErpInvoiceMessageRecord, 1, JsonUtils.getInstance().toJsonString(outPut),
"FI847接口接收erp发票数据出错,异常信息:"+"{"+JSONObject.toJSONString(e)+"}"); "FI847接口接收erp发票数据出错,异常信息:"+"{"+JSONObject.toJSONString(e)+"}");
} catch (Exception exception) { } catch (Exception exception) {
log.error("FI847接口记录保存失败,errormsg:{}",e.getMessage()); log.error("FI847接口记录保存失败,errormsg:{}",e);
exception.printStackTrace();
} }
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);
@ -1302,8 +1329,7 @@ public class InterfaceController extends AbstractController {
requestRecordService.saveFailedRequestRecord(transferOutRecord, 0, JsonUtils.getInstance().toJsonString(outPut), requestRecordService.saveFailedRequestRecord(transferOutRecord, 0, JsonUtils.getInstance().toJsonString(outPut),
es.getZMESSAGE()); es.getZMESSAGE());
} catch (Exception e) { } catch (Exception e) {
log.error("FI849接口记录保存失败,errormsg:{}",e.getMessage()); log.error("FI849接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);
@ -1355,8 +1381,7 @@ public class InterfaceController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(transferOutRecord, transfer); requestRecordService.saveSuccessfulRequestRecord(transferOutRecord, transfer);
} catch (Exception e) { } catch (Exception e) {
log.error("FI849接口记录保存失败,errormsg:{}",e.getMessage()); log.error("FI849接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return transfer; return transfer;
@ -1375,8 +1400,7 @@ public class InterfaceController extends AbstractController {
requestRecordService.saveFailedRequestRecord(transferOutRecord,1, JsonUtils.getInstance().toJsonString(outPut), requestRecordService.saveFailedRequestRecord(transferOutRecord,1, JsonUtils.getInstance().toJsonString(outPut),
"进项税转出(FI849)处理出现异常,异常信息:"+"{"+JSONObject.toJSONString(e)+"}"); "进项税转出(FI849)处理出现异常,异常信息:"+"{"+JSONObject.toJSONString(e)+"}");
} catch (Exception exception) { } catch (Exception exception) {
log.error("FI849接口记录保存失败,errormsg:{}",e.getMessage()); log.error("FI849接口记录保存失败,errormsg:{}",e);
exception.printStackTrace();
} }
return JsonUtils.getInstance().toJsonString(outPut); return JsonUtils.getInstance().toJsonString(outPut);

@ -47,8 +47,16 @@ public class RequestRecallController extends AbstractController {
String methodName = (String) params.get("startTime"); String methodName = (String) params.get("startTime");
Integer pageNumber = (Integer) params.get("pageNumber"); Integer pageNumber = (Integer) params.get("pageNumber");
Integer pageSize = (Integer) params.get("pageSize"); Integer pageSize = (Integer) params.get("pageSize");
Integer orderBy = (Integer) params.get("orderBy");
JSONObject resultJson = requestRecordService.getRecordList(portName, startTime, endTime, status, methodName, pageNumber, pageSize); JSONObject resultJson = requestRecordService.getRecordList(portName, startTime, endTime, status, methodName, pageNumber, pageSize, orderBy);
return ResponseEntity.ok(R.ok().put("data",resultJson));
}
@ApiOperation(value = "接口记录详细查询", notes = "接口记录详细查询")
@RequestMapping(path = "/requestDetailRecordBatch", method = {RequestMethod.POST, RequestMethod.GET})
public ResponseEntity<?> batchRequestDetailRecord(Integer id) {
JSONObject resultJson = requestRecordService.getDetailRecord(id);
return ResponseEntity.ok(R.ok().put("data",resultJson)); return ResponseEntity.ok(R.ok().put("data",resultJson));
} }

@ -139,8 +139,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord, JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord, JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
@ -159,8 +158,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,JSONObject.toJSONString(R.error("发票号码不能为空!")), "发票号码不能为空!"); requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,JSONObject.toJSONString(R.error("发票号码不能为空!")), "发票号码不能为空!");
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!")));
@ -180,8 +178,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0, requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,
JSONObject.toJSONString(R.error("开票日期不能为空!")), "开票日期不能为空!"); JSONObject.toJSONString(R.error("开票日期不能为空!")), "开票日期不能为空!");
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
@ -194,8 +191,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0, requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,
JSONObject.toJSONString(R.error("发票类型不能为空!")), "发票类型不能为空!"); JSONObject.toJSONString(R.error("发票类型不能为空!")), "发票类型不能为空!");
} catch (BaseException e) { } catch (BaseException e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票类型不能为空!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票类型不能为空!")));
@ -228,8 +224,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0, requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,
JSONObject.toJSONString(R.error("校验码不能为空!")), "校验码不能为空!"); JSONObject.toJSONString(R.error("校验码不能为空!")), "校验码不能为空!");
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!")));
@ -252,8 +247,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0, requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,
JSONObject.toJSONString(R.error(notes)), notes); JSONObject.toJSONString(R.error(notes)), notes);
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
@ -327,8 +321,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -359,8 +352,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord, JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord, JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -388,8 +380,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,1,JSONObject.toJSONString(R.error("查验失败,"+e.getMessage())), requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,1,JSONObject.toJSONString(R.error("查验失败,"+e.getMessage())),
"查验失败,异常信息:{}"+JSONObject.toJSONString(e.getMessage())); "查验失败,异常信息:{}"+JSONObject.toJSONString(e.getMessage()));
} catch (Exception exception) { } catch (Exception exception) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
exception.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error("查验失败,"+e.getMessage()))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("查验失败,"+e.getMessage())));
@ -406,8 +397,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord, 0,JSONObject.toJSONString(data), requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord, 0,JSONObject.toJSONString(data),
(String) checkInvoiceResult.get("cyjgxx")); (String) checkInvoiceResult.get("cyjgxx"));
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -427,8 +417,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
} }
@ -466,8 +455,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(singleInvoiceCheckRecord,JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -479,8 +467,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)), requestRecordService.saveFailedRequestRecord(singleInvoiceCheckRecord,0,JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)),
"未知异常,请联系管理员"); "未知异常,请联系管理员");
} catch (Exception e) { } catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票查验接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
@ -818,8 +805,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveFailedRequestRecord(record,0, JSONObject.toJSONString(R.error(result)), result); requestRecordService.saveFailedRequestRecord(record,0, JSONObject.toJSONString(R.error(result)), result);
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(result))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(result)));
@ -851,8 +837,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -866,8 +851,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)), requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)),
"推送sap失败,失败原因:"+"{"+JSONObject.toJSONString(e)+"}"); "推送sap失败,失败原因:"+"{"+JSONObject.toJSONString(e)+"}");
} catch (Exception exception) { } catch (Exception exception) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
exception.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)));
@ -894,8 +878,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -920,8 +903,7 @@ public class SDNYMainProcessController extends AbstractController {
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE);
requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data)); requestRecordService.saveSuccessfulRequestRecord(record, JSONObject.toJSONString(data));
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(data)); return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -937,8 +919,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT)), requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT)),
"同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}"); "同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}");
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT)));
@ -951,8 +932,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT)), requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT)),
"同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}"); "同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}");
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT)));
@ -965,8 +945,7 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)), requestRecordService.saveFailedRequestRecord(record,1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)),
"同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}"); "同步SAP失败,报错信息为:"+"{"+JSONObject.toJSONString(exception)+"}");
} catch (Exception e) { } catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage()); log.error("发票同步接口记录保存失败,errormsg:{}",e);
e.printStackTrace();
} }
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT))); return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)));

@ -25,5 +25,13 @@ public interface RequestRecordDao extends BaseMapper<RequestRecord> {
@Param("startTime") Date startTime, @Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("endTime") Date endTime,
@Param("status") Integer status, @Param("status") Integer status,
@Param("methodName") String methodName); @Param("methodName") String methodName,
@Param("orderBy") Integer orderBy);
/**
* 查询记录详情
* @param id
* @return
*/
RequestRecord selectDetailRecord(Integer id);
} }

@ -13,7 +13,9 @@ public interface RequestRecordService extends MpBaseService<RequestRecord> {
int saveFailedRequestRecord(RequestRecord record, Integer isRecall, String responseDetail, String failedReason); int saveFailedRequestRecord(RequestRecord record, Integer isRecall, String responseDetail, String failedReason);
JSONObject getRecordList(String portName, Date startTime, Date endTime, Integer status, String methodName, Integer pageNumber, Integer PageSize); JSONObject getRecordList(String portName, Date startTime, Date endTime, Integer status, String methodName, Integer pageNumber, Integer PageSize, Integer orderBy);
JSONObject getDetailRecord(Integer id);
RequestRecord getBaseRequestRecord(String requestDetail, String portName, String invoiceCode, String invoiceNo, String methodName); RequestRecord getBaseRequestRecord(String requestDetail, String portName, String invoiceCode, String invoiceNo, String methodName);

@ -68,11 +68,12 @@ public class RequestRecordServiceImpl extends MpBaseServiceImpl<RequestRecordDao
@Override @Override
@DataSource(name = "business_business_read") @DataSource(name = "business_business_read")
public JSONObject getRecordList(String portName, Date startTime, Date endTime, Integer status, String methodName, Integer pageNumber, Integer pageSize) { public JSONObject getRecordList(String portName, Date startTime, Date endTime,
Integer status, String methodName, Integer pageNumber, Integer pageSize, Integer orderBy) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
try { try {
PageHelper.startPage(pageNumber, pageSize); PageHelper.startPage(pageNumber, pageSize);
List<RequestRecord> recordList = requestRecordDao.selectRecordList(portName, startTime, endTime, status, methodName); List<RequestRecord> recordList = requestRecordDao.selectRecordList(portName, startTime, endTime, status, methodName, orderBy);
PageInfo<RequestRecord> pageInfo = new PageInfo<>(recordList); PageInfo<RequestRecord> pageInfo = new PageInfo<>(recordList);
json.put("datalist",recordList); json.put("datalist",recordList);
@ -87,6 +88,21 @@ public class RequestRecordServiceImpl extends MpBaseServiceImpl<RequestRecordDao
} }
} }
@Override
@DataSource(name = "business_business_read")
public JSONObject getDetailRecord(Integer id) {
JSONObject json = new JSONObject();
try {
RequestRecord detailRecord = requestRecordDao.selectDetailRecord(id);
log.info("查询结果:{}", JSONObject.toJSONString(detailRecord));
return json;
} catch (Exception e) {
log.error("查询记录详情出现异常,异常信息:{}",e);
json.put("data",null);
return json;
}
}
@Override @Override
public RequestRecord getBaseRequestRecord(String requestDetail, String portName, String invoiceCode, String invoiceNo, String methodName) { public RequestRecord getBaseRequestRecord(String requestDetail, String portName, String invoiceCode, String invoiceNo, String methodName) {
return RequestRecord.builder() return RequestRecord.builder()
@ -130,6 +146,9 @@ public class RequestRecordServiceImpl extends MpBaseServiceImpl<RequestRecordDao
if (dbRecord == null) { if (dbRecord == null) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("请求信息错误,请确认后再发送!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("请求信息错误,请确认后再发送!")));
} }
if (dbRecord.getActiveCall() == null) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("暂只支持发票系统主动调用外部系统的补偿!")));
}
if (dbRecord.getStatus() == 0) { if (dbRecord.getStatus() == 0) {
return ResponseEntity.ok(JSONObject.toJSONString(R.error("该请求已成功,无法继续重调!"))); return ResponseEntity.ok(JSONObject.toJSONString(R.error("该请求已成功,无法继续重调!")));
} }

@ -5,6 +5,18 @@
<mapper namespace="com.dxhy.erp.dao.RequestRecordDao"> <mapper namespace="com.dxhy.erp.dao.RequestRecordDao">
<resultMap id="BaseResultMap" type="com.dxhy.erp.entity.RequestRecord"> <resultMap id="BaseResultMap" type="com.dxhy.erp.entity.RequestRecord">
<id column="id" property="id" />
<result column="request_detail" property="requestDetail" />
<result column="response_detail" property="responseDetail" />
<result column="port_name" property="portName" />
<result column="retry_times" property="retryTimes" />
<result column="failed_times" property="failedTimes" />
<result column="create_time" property="createTime" />
<result column="status" property="status" />
<result column="method_name" property="methodName" />
</resultMap>
<resultMap id="DetailResultMap" type="com.dxhy.erp.entity.RequestRecord">
<id column="id" property="id" /> <id column="id" property="id" />
<result column="bzdh" property="bzdh" /> <result column="bzdh" property="bzdh" />
<result column="invoice_code" property="invoiceCode" /> <result column="invoice_code" property="invoiceCode" />
@ -19,26 +31,26 @@
<result column="last_retry_time" property="lastRetryTime" /> <result column="last_retry_time" property="lastRetryTime" />
<result column="status" property="status" /> <result column="status" property="status" />
<result column="method_name" property="methodName" /> <result column="method_name" property="methodName" />
<result column="active_call" property="activeCall" /> <result column="active_call" property="activeCall"/>
<result column="failed_reason" property="failedReason"/>
<result column="recall_response_detail" property="recallResponseDetail"/>
<result column="active_call_response" property="activeCallResponse"/>
<result column="is_recall" property="isRecall"/>
<result column="active_call_recall_response" property="activeCallRecallResponse"/>
<result column="active_call_request_detail" property="activeCallRequestDetail"/>
</resultMap> </resultMap>
<select id="selectRecordList" resultMap="BaseResultMap"> <select id="selectRecordList" resultMap="BaseResultMap">
select select
id, id,
bzdh,
invoice_code,
image_id,
invoice_no,
request_detail, request_detail,
response_detail, response_detail,
port_name, port_name,
retry_times, retry_times,
failed_times, failed_times,
create_time, create_time,
last_retry_time,
status, status,
method_name, method_name from t_dx_erp_request_record
active_call from t_dx_erp_request_record
<where> <where>
<if test="portName!=null and portName!=''"> <if test="portName!=null and portName!=''">
and port_name=#{portName} and port_name=#{portName}
@ -58,7 +70,39 @@
and method_name=#{methodName} and method_name=#{methodName}
</if> </if>
</where> </where>
order by create_time <if test="orderBy==1">
order by create_time desc
</if>
<if test="orderBy==0">
order by create_time asc
</if>
</select>
<select id="selectDetailRecord" resultMap="DetailMap">
select
id,
bzdh,
invoice_code,
image_id,
invoice_no,
request_detail,
response_detail,
port_name,
retry_times,
failed_times,
create_time,
status,
last_retry_time,
method_name,
active_call,
failed_reason,
recall_response_detail,
active_call_response,
is_recall,
active_call_recall_response,
active_call_request_detail
from t_dx_erp_request_record where id = #{id}
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save