Commit f4129379e5d7c4581f25871301f6e1c3d70dc0cb
1 parent
79d18b7b
http工具类post调用问题/一级菜单修改问题修复
Signed-off-by: TanYibin <5491541@qq.com>
Showing
2 changed files
with
3 additions
and
53 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysPermissionServiceImpl.java
... | ... | @@ -185,7 +185,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S |
185 | 185 | // ---------------------------------------------------------------------- |
186 | 186 | // Step1.判断是否是一级菜单,是的话清空父菜单ID |
187 | 187 | if (CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) { |
188 | - sysPermission.setParentId(0); | |
188 | + sysPermission.setParentId(null); | |
189 | 189 | } |
190 | 190 | // Step2.判断菜单下级是否有菜单,无则设置为叶子节点 |
191 | 191 | int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId())); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/OkHttpUtils.java
... | ... | @@ -85,7 +85,7 @@ public class OkHttpUtils { |
85 | 85 | * @throws Exception |
86 | 86 | */ |
87 | 87 | public static String sendGet(String url, String param) { |
88 | - Map<String, String> headers = new HashMap<String, String>(); | |
88 | + Map<String, String> headers = new HashMap<>(); | |
89 | 89 | return sendGet(url, headers, param); |
90 | 90 | } |
91 | 91 | |
... | ... | @@ -126,58 +126,8 @@ public class OkHttpUtils { |
126 | 126 | return result; |
127 | 127 | } |
128 | 128 | |
129 | - /** | |
130 | - * 向指定 URL 发送POST方法的请求 | |
131 | - * @param url 发送请求的 URL | |
132 | - * @param param 请求参数,请求参数是 name1=value1&name2=value2 的形式 | |
133 | - * @return 远程资源的响应结果 | |
134 | - * @throws IOException | |
135 | - */ | |
136 | - public static String sendPost(String url, String param) throws IOException { | |
137 | - Map<String, String> headers = new HashMap<String, String>(); | |
138 | - return sendPost(url, headers, param); | |
139 | - } | |
140 | - | |
141 | - /** | |
142 | - * 向指定 URL 发送POST方法的请求 | |
143 | - * @param url 发送请求的 URL | |
144 | - * @param param 请求参数,请求参数是 name1=value1&name2=value2 的形式 | |
145 | - * @param headers 请求头 | |
146 | - * @return 远程资源的响应结果 | |
147 | - * @throws IOException | |
148 | - */ | |
149 | - public static String sendPost(String url, Map<String, String> headers, String param) { | |
150 | - ApiLog apiLog = new ApiLog(); | |
151 | - Request.Builder builder = new Request.Builder(); | |
152 | - buildHeader(builder, headers); | |
153 | - FormBody body = new FormBody.Builder().build(); | |
154 | - Request request = builder.url(url + "?" + param).post(body).build(); | |
155 | - Response response = null; | |
156 | - String result = null; | |
157 | - try { | |
158 | - ApiLoggerAspect.initApiLog(apiLog, request, param); | |
159 | - response = HTTP_CLIENT.newCall(request).execute(); | |
160 | - result = response.body().string(); | |
161 | - } catch (Exception e) { | |
162 | - String errorString = | |
163 | - StrUtil.format("执行POST请求异常,url:{},header:{},param:{},errorMessage:{}", url, JSON.toJSONString(headers), param, e.getMessage()); | |
164 | - ApiLoggerAspect.setApiLogException(apiLog, e); | |
165 | - throw new RuntimeException(errorString, e); | |
166 | - } finally { | |
167 | - ApiLoggerAspect.finishApiLog(apiLog, response, result); | |
168 | - } | |
169 | - if (response.isSuccessful() && Objects.nonNull(response.body())) {// 调用成功 | |
170 | - log.info("执行POST请求成功,url:{},header:{},param:{},result:{}", url, JSON.toJSONString(headers), param, result); | |
171 | - } else { | |
172 | - String errorString = StrUtil.format("执行POST请求失败,url:{},header:{},param:{},responseCode:{},responseMessage:{}", url, | |
173 | - JSON.toJSONString(headers), param, response.code(), response.message()); | |
174 | - throw new RuntimeException(errorString); | |
175 | - } | |
176 | - return result; | |
177 | - } | |
178 | - | |
179 | 129 | public static String sendPostByJsonStr(String url, String jsonString) { |
180 | - Map<String, String> headers = new HashMap<String, String>(); | |
130 | + Map<String, String> headers = new HashMap<>(); | |
181 | 131 | return sendPostByJsonStr(url, headers, jsonString); |
182 | 132 | } |
183 | 133 | |
... | ... |