From 0511a553bd3fd8a193d5a98d58c6ef5f89a17c90 Mon Sep 17 00:00:00 2001 From: ChenJiaHe <763432473@qq.com> Date: 星期三, 31 三月 2021 10:10:09 +0800 Subject: [PATCH] excel导入兼容多版本 --- src/main/java/com/hx/util/ExcelUtil.java | 2 -- src/main/java/com/hx/mp/util/CorpMpUtil.java | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hx/mp/util/CorpMpUtil.java b/src/main/java/com/hx/mp/util/CorpMpUtil.java index ccd4824..b541e1c 100644 --- a/src/main/java/com/hx/mp/util/CorpMpUtil.java +++ b/src/main/java/com/hx/mp/util/CorpMpUtil.java @@ -71,6 +71,42 @@ } return -1; } + + /** + * 娣诲姞宸ヤ綔浜哄憳 + * @param at 璁块棶at + * @param userId 鐢ㄦ埛id + * @param name 鍚嶇О + * @param depId 閮ㄩ棬id + * @param position 鑱屼綅 + * @param tel 鐢佃瘽 + * @param email 閭 + * @return 杩斿洖 + */ + public static JSONObject addUserObj(String at, String userId, String name, int depId + , String position,String tel,String email) { + + if(StringUtils.isEmpty(tel)&&StringUtils.isEmpty(email)){ + throw new TipsException("娣诲姞浼佷笟寰俊鎵嬫満鍙峰拰閭涓嶈兘閮戒负绌猴紒"); + } + + JSONObject obj = new JSONObject(); + obj.put("userid", userId); + obj.put("name", name); + obj.put("department", depId); + obj.put("position", position); + obj.put("mobile", tel); + obj.put("email", email); + obj = HttpURLUtil(MessageFormat.format(URL_ADD_USER, at), obj.toString()); + + if(obj == null){ + obj = new JSONObject(); + } + + return obj; + + } + /** * 鏇存柊宸ヤ綔浜哄憳 * @param at 璁块棶at diff --git a/src/main/java/com/hx/util/ExcelUtil.java b/src/main/java/com/hx/util/ExcelUtil.java index 206d154..88fe7f1 100644 --- a/src/main/java/com/hx/util/ExcelUtil.java +++ b/src/main/java/com/hx/util/ExcelUtil.java @@ -381,8 +381,6 @@ // 缁撴灉闆� List<List<String>> list = new ArrayList<>(); - - Map<String, List<List<Map<Integer,String>>>> data = new HashMap<String, List<List<Map<Integer,String>>>>(); Workbook book = create(new BufferedInputStream(file.getInputStream())); // 閬嶅巻璇ヨ〃鏍间腑鎵�鏈夌殑宸ヤ綔琛紝i琛ㄧず宸ヤ綔琛ㄧ殑鏁伴噺 getNumberOfSheets琛ㄧず宸ヤ綔琛ㄧ殑鎬绘暟 -- Gitblit v1.8.0