ariesy 增加异常代码返回判断

release
yefei 2 years ago
parent c4d7fa91e9
commit 7281f52a03
  1. 69
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java

@ -206,6 +206,16 @@ public class SDNYMainProcessController extends AbstractController {
}
if (!checkInvoiceResult.containsKey("code")) {
if (checkInvoiceResult.containsKey("cyjg")) {
R data = new R();
data = errorInfo(checkInvoiceResult, data);
data.put("data", checkInvoiceResult);
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
}
R data = new R(1000, "default success");
data.put("message", "success");
data.put("data", checkInvoiceResult);
@ -241,6 +251,65 @@ public class SDNYMainProcessController extends AbstractController {
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
}
private R errorInfo(JSONObject checkInvoiceResult, R data) {
if ("0002".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1002, checkInvoiceResult.getString("cyjgxx"));
}
if ("0005".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1003, checkInvoiceResult.getString("cyjgxx"));
}
if ("0006".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1004, checkInvoiceResult.getString("cyjgxx"));
}
if ("0009".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1005, checkInvoiceResult.getString("cyjgxx"));
}
if ("1004".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1006, checkInvoiceResult.getString("cyjgxx"));
}
if ("1005".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1007, checkInvoiceResult.getString("cyjgxx"));
}
if ("1006".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1008, checkInvoiceResult.getString("cyjgxx"));
}
if ("1008".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1009, checkInvoiceResult.getString("cyjgxx"));
}
if ("1009".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1010, checkInvoiceResult.getString("cyjgxx"));
}
if ("1010".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1011, checkInvoiceResult.getString("cyjgxx"));
}
if ("1014".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1012, checkInvoiceResult.getString("cyjgxx"));
}
if ("1015".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1013, checkInvoiceResult.getString("cyjgxx"));
}
if ("1020".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1014, checkInvoiceResult.getString("cyjgxx"));
}
if ("1021".equals(checkInvoiceResult.getString("cyjg"))) {
data = new R(1015, checkInvoiceResult.getString("cyjgxx"));
}
return data;
}
private void convertToResult(JSONObject checkInvoice) throws ParseException {
checkInvoice.put("totalTax", checkInvoice.getString("taxAmount"));
checkInvoice.put("amountTax", checkInvoice.getString("totalAmount"));

Loading…
Cancel
Save