From d60979e98c6492b562e38bfe6f7925a3809892fe Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期二, 18 三月 2025 15:19:27 +0800 Subject: [PATCH] Wms仓库相关代码 --- src/main/java/com/whyc/util/HttpUtil.java | 53 +++++------------------------------------------------ 1 files changed, 5 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/whyc/util/HttpUtil.java b/src/main/java/com/whyc/util/HttpUtil.java index d3c6e54..2c8ebab 100644 --- a/src/main/java/com/whyc/util/HttpUtil.java +++ b/src/main/java/com/whyc/util/HttpUtil.java @@ -57,51 +57,6 @@ return getSession().getServletContext(); } - /* - * 鑾峰彇灏嗗璞¤浆鎹㈡垚json鏍煎紡 - */ - public static String toJson(Object obj){ - Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); - return gson.toJson(obj); - } - - public static String chageDateToString(Date time,String type){ - String msg = ""; - SimpleDateFormat sdf = new SimpleDateFormat(type); - msg = sdf.format(time); - return msg; - } - - - /** - * - * @param datetype 闇�瑕佽В鏋愮殑鏃ユ湡鐨勬牸寮忓锛�"yyyy-MM-dd HH:mm:ss" - * @return 寰楀埌瀵瑰簲鐨刧son瀵硅薄 - */ - public static Gson getGson(String datetype){ - return new GsonBuilder().setDateFormat(datetype).create(); - } - - /** - * 鑾峰彇榛樿鐨刧son瀵硅薄 - * @return - */ - public static Gson getGson(){ - return new Gson(); - } - - - public static <T> T getObject(String jsonstring,Type listtype){ - Gson gson=new Gson(); - T t=null; - try { - t=gson.fromJson(jsonstring, listtype); - } catch (JsonSyntaxException e) { - e.printStackTrace(); - } - return t; - } - /** * get鏂瑰紡鐨刪ttp璇锋眰 * @@ -145,7 +100,7 @@ } catch (IOException e) { response.set(0); String message = e.getMessage(); - response.setData(message); + response.setMsg(message); } finally { // 鍏抽棴璧勬簮 if (null != bufferedReader) { @@ -216,7 +171,7 @@ } catch (IOException e) { String message = e.getMessage(); response.set(0); - response.setData(message); + response.setMsg(message); } finally { // 鍏抽棴璧勬簮 if (null != bufferedReader) { @@ -268,7 +223,9 @@ } /** + * 鐢ㄤ簬Video 鐨凥ttp鎺ュ彛璇锋眰 * 鎵цGET璇锋眰,浼犲叆Map鍙傛暟鍜孶rl,鑾峰彇鍝嶅簲 + * 杩欎釜瀵瑰師濮嬬殑doGet鏂规硶杩涜浜嗚皟鐢�,瀵圭粨鏋滆繘琛屽悗缁�昏緫鍐嶅鐞�,灞炰簬瀹氬埗鍖栫殑鎺ュ彛浜�. */ public static Response4Http doGet(String httpUrl, Map<String, ?> params) { Response4Http responseResult = new Response4Http<>(); @@ -278,7 +235,7 @@ Integer httpResponseCode = response.getCode(); String responseJson = (String) response.getData(); if(httpResponseCode == 1) { //璇锋眰鎴愬姛 - Response4Http responseHttp = HttpUtil.getGson().fromJson(responseJson, Response4Http.class); + Response4Http responseHttp = JsonUtil.getGson().fromJson(responseJson, Response4Http.class); if(responseHttp.getCode() == 0 ) { //鎺ュ彛杩斿洖鐘舵�佺爜涓烘垚鍔� //杩斿洖淇℃伅鏈� data灞炴�� if(responseHttp.getData()!=null) { -- Gitblit v1.9.1