代码修改

release
xuliangwei 2 years ago
parent b54cec37ed
commit b137b47b8e
  1. 15
      dxhy-erp/src/main/java/com/dxhy/erp/controller/InterfaceController.java
  2. 114
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java

@ -1220,11 +1220,16 @@ public class InterfaceController extends AbstractController {
EsOutPutResp esOutPutResp=invoiceAuthService.receiveErpInvoiceMessage(erpInvoiceData.getIS_INPUT());
outPut.setES_OUTPUT(esOutPutResp);
try {
if (esOutPutResp.getZMESSAGE().contains("不存在")) {
requestRecordService.saveRecord(receiveErpInvoiceMessageRecord, 1,1, JsonUtils.getInstance().toJsonString(outPut),0);
} else {
requestRecordService.saveRecord(receiveErpInvoiceMessageRecord, 0,0, JsonUtils.getInstance().toJsonString(outPut));
}
} catch (Exception e) {
log.error("FI847接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return JsonUtils.getInstance().toJsonString(outPut);
}catch (Exception e){
@ -1277,7 +1282,12 @@ public class InterfaceController extends AbstractController {
es.setZMESSAGE("底账数据不存在");
outPut.setES_OUTPUT(es);
try {
requestRecordService.saveRecord(transferOutRecord, 1, 1, JsonUtils.getInstance().toJsonString(outPut), 0);
} catch (Exception e) {
log.error("FI849接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return JsonUtils.getInstance().toJsonString(outPut);
}
@ -1324,7 +1334,12 @@ public class InterfaceController extends AbstractController {
}
}
try {
requestRecordService.saveRecord(transferOutRecord,0, 0, transfer);
} catch (Exception e) {
log.error("FI849接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return transfer;
}catch (Exception e){

@ -18,11 +18,8 @@ import com.dxhy.erp.entity.*;
import com.dxhy.erp.entity.sdny.*;
import com.dxhy.erp.model.InvoiceDetailInfo;
import com.dxhy.erp.service.*;
import com.dxhy.erp.service.impl.GatherServiceImpl;
import com.dxhy.erp.utils.Base64;
import com.dxhy.erp.utils.CheckUtil;
import com.dxhy.erp.utils.HmacSHA1Util;
import com.google.gson.JsonArray;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@ -134,7 +131,13 @@ public class SDNYMainProcessController extends AbstractController {
data.put("message", "success");
data.put("data", checkInvoiceResult);
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord, 0,0, JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
@ -147,7 +150,12 @@ public class SDNYMainProcessController extends AbstractController {
//权限校验
if (StringUtils.isBlank(pramsMap.get("invoiceNumber"))) {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("发票号码不能为空!")),0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!")));
}
@ -161,14 +169,24 @@ public class SDNYMainProcessController extends AbstractController {
pramsMap.put("billingDate", billingDate);
} else {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("开票日期不能为空!")), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
}
if (StringUtils.isBlank(pramsMap.get("invoiceType"))) {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("发票类型不能为空!")), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票类型不能为空!")));
}
@ -181,14 +199,24 @@ public class SDNYMainProcessController extends AbstractController {
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) {
if (StringUtils.isBlank(pramsMap.get("totalAmount"))) {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("金额不能为空!")), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!")));
}
} else {
if (StringUtils.isBlank(pramsMap.get("checkCode"))) {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("校验码不能为空!")), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!")));
}
@ -205,7 +233,12 @@ public class SDNYMainProcessController extends AbstractController {
String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo());
if (notes != null) {
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error(notes)), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes)));
}
@ -261,6 +294,7 @@ public class SDNYMainProcessController extends AbstractController {
//查验结果保存
// saveCheckLog(pramsMap, checkInvoice);
try {
if (checkInvoiceResult!=null && checkInvoiceResult.containsKey("code")) {
if (checkInvoiceResult.containsKey("cyjg")) {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(data), 0);
@ -270,6 +304,10 @@ public class SDNYMainProcessController extends AbstractController {
requestRecordService.saveRecord(singleInvoiceCheckRecord,0,0,JSONObject.toJSONString(data));
}
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
} else {
@ -295,7 +333,12 @@ public class SDNYMainProcessController extends AbstractController {
//查验结果保存
// saveCheckLog(pramsMap,checkInvoice);
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,0,0,JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
@ -315,7 +358,12 @@ public class SDNYMainProcessController extends AbstractController {
e.printStackTrace();
log.error("查验失败,errormsg:{}",e.getMessage());
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error("查验失败,"+e.getMessage())), 1);
} catch (Exception exception) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
exception.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error("查验失败,"+e.getMessage())));
}
@ -326,7 +374,12 @@ public class SDNYMainProcessController extends AbstractController {
R data = new R();
data = errorInfo(checkInvoiceResult, data);
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(data), 0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -342,7 +395,12 @@ public class SDNYMainProcessController extends AbstractController {
log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, userid, "1", dbName);
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,0,0,JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -364,13 +422,23 @@ public class SDNYMainProcessController extends AbstractController {
data.put("data", checkInvoiceResult);
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,0,0,JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
}
try {
requestRecordService.saveRecord(singleInvoiceCheckRecord,1,1,JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)),0);
} catch (Exception e) {
log.error("发票查验接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
}
@ -700,7 +768,12 @@ public class SDNYMainProcessController extends AbstractController {
R data = new R(1000, "default success");
data.put("data", result);
try {
requestRecordService.saveRecord(record,0, 0, JSONObject.toJSONString(R.error(result)));
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(result)));
}
@ -729,7 +802,12 @@ public class SDNYMainProcessController extends AbstractController {
R data = new R(1000, "default success");
data.put("data", result);
try {
requestRecordService.saveRecord(record,0, 0, JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
} catch (Exception e) {
@ -737,7 +815,12 @@ public class SDNYMainProcessController extends AbstractController {
log.error("", e);
// requestRecordService.saveRecord(pushCheckResultToSAPRecord,1, 1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)), 1);
try {
requestRecordService.saveRecord(record,1, 1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)), 1);
} catch (Exception exception) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
exception.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)));
}
@ -759,7 +842,12 @@ public class SDNYMainProcessController extends AbstractController {
R data = new R(1000, "default success");
data.put("data", "");
try {
requestRecordService.saveRecord(record,0, 0, JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
} else {
@ -779,7 +867,12 @@ public class SDNYMainProcessController extends AbstractController {
R data = new R(1000, "default success");
data.put("data", "");
try {
requestRecordService.saveRecord(record,0, 0, JSONObject.toJSONString(data));
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(data));
@ -789,21 +882,36 @@ public class SDNYMainProcessController extends AbstractController {
log.error("同步SAP失败,报错信息为:{}", exception);
exception.printStackTrace();
try {
requestRecordService.saveRecord(record,1, 1, JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT)),1);
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.CONNECT_TIMEOUT)));
} catch(NullPointerException exception){
log.error("同步SAP失败,报错信息为:{}", exception);
exception.printStackTrace();
try {
requestRecordService.saveRecord(record,1, 1, JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT)), 1);
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.NULL_POINTER_TIMEOUT)));
} catch(Exception exception){
log.error("同步SAP失败,报错信息为:{}", exception);
exception.printStackTrace();
try {
requestRecordService.saveRecord(record,1, 1, JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)),1);
} catch (Exception e) {
log.error("发票同步接口记录保存失败,errormsg:{}",e.getMessage());
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)));
}

Loading…
Cancel
Save