From c372fff59cd725b6ce8e3b34af4b7fec8dd8c432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 1 Jul 2022 15:18:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/util/ResponseResult.java | 45 ++++++++++++------- .../engine/salary/web/TaxAgentController.java | 8 ++-- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/com/engine/salary/util/ResponseResult.java b/src/com/engine/salary/util/ResponseResult.java index 05329d835..fe09c3efe 100644 --- a/src/com/engine/salary/util/ResponseResult.java +++ b/src/com/engine/salary/util/ResponseResult.java @@ -54,7 +54,7 @@ public class ResponseResult { return Error(cause.getMessage()); } catch (Exception e) { log.error("salary api run fail", e); - return Error(e.getMessage()); + return Error("系统异常!"); } } @@ -76,7 +76,7 @@ public class ResponseResult { return Error(cause.getMessage()); } catch (Exception e) { log.error("salary api run fail", e); - return Error(e.getMessage()); + return Error("系统异常!", e); } } @@ -98,23 +98,10 @@ public class ResponseResult { return Error(cause.getMessage()); } catch (Exception e) { log.error("salary api run fail", e); - return Error(e.getMessage()); + return Error("系统异常!", e); } } - /** - * 成功返回 - */ - private String Ok(R r) { - Map apidatas = new HashMap<>(); - apidatas.put("status", true); - apidatas.put("data", r); - String success = getJsonString(apidatas); - if (isLog) { - log.info("run salary api success return {}", success); - } - return success; - } private static String getJsonString(Object apidatas) { ObjectMapper mapper = new ObjectMapper(); @@ -137,6 +124,21 @@ public class ResponseResult { } + /** + * 成功返回 + */ + private String Ok(R r) { + Map apidatas = new HashMap<>(); + apidatas.put("status", true); + apidatas.put("data", r); + String success = getJsonString(apidatas); + if (isLog) { + log.info("run salary api success return {}", success); + } + return success; + } + + /** * 失败返回 */ @@ -148,4 +150,15 @@ public class ResponseResult { } + /** + * 系统异常失败返回 + */ + private static String Error(String message, Exception e) { + Map apidatas = new HashMap<>(); + apidatas.put("status", false); + apidatas.put("errormsg", message); + apidatas.put("error", e.getMessage()); + return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); + } + } diff --git a/src/com/engine/salary/web/TaxAgentController.java b/src/com/engine/salary/web/TaxAgentController.java index 6e22715c1..15d050c01 100644 --- a/src/com/engine/salary/web/TaxAgentController.java +++ b/src/com/engine/salary/web/TaxAgentController.java @@ -132,8 +132,8 @@ public class TaxAgentController { /** * 获取个税扣缴义务人表单 * - * @param id - * @return + * @param id 表单id + * @return 表单对象 */ @GET @Path("/getForm") @@ -146,8 +146,8 @@ public class TaxAgentController { /** * 新建个税扣缴义务人 * - * @param saveParam - * @return + * @param saveParam 个税扣缴义务人保存参数 + * @return 个税扣缴义务人id */ @POST @Path("/save")