解决调用大数据接口请求返回异常

This commit is contained in:
dinggang 2022-05-30 18:59:33 +08:00
parent 10b9bf8906
commit 12dcb9910d
2 changed files with 11 additions and 5 deletions

View File

@ -42,7 +42,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
for (CategoryDTO categoryDto : topCategory) { for (CategoryDTO categoryDto : topCategory) {
if (categoryDao.selectByParentId(categoryDto.getId()).isEmpty()) { if (categoryDao.selectByParentId(categoryDto.getId()).isEmpty()) {
categoryDto.setIsLeaf("Y"); categoryDto.setIsLeaf("Y");
categoryDto.setChildren(null); categoryDto.setChildren(new ArrayList());
} else { } else {
ArrayList<CategoryDTO> list = new ArrayList<>(); ArrayList<CategoryDTO> list = new ArrayList<>();
categoryDao.selectByParentId(categoryDto.getId()) categoryDao.selectByParentId(categoryDto.getId())
@ -84,6 +84,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
wrapper.eq("root_category", topCategoryName) wrapper.eq("root_category", topCategoryName)
.eq("del_flag",0) .eq("del_flag",0)
.eq("is_link_to_dic", "true") .eq("is_link_to_dic", "true")
.eq("is_filter_criteria", "true")
.orderByAsc("xh"); .orderByAsc("xh");
List<Category> categories = categoryDao.selectList(wrapper); List<Category> categories = categoryDao.selectList(wrapper);
ArrayList<Map> resultList = new ArrayList<>(); ArrayList<Map> resultList = new ArrayList<>();

View File

@ -188,11 +188,16 @@ public class ResourceController {
requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort"); requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort");
requestHeaders.setContentType(MediaType.TEXT_XML); requestHeaders.setContentType(MediaType.TEXT_XML);
HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders); HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders);
String body = restTemplate.postForEntity(url,requestEntity,String.class).getBody(); try {
String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1); String body = restTemplate.postForEntity(url,requestEntity,String.class).getBody();
HashMap map = JSONObject.parseObject(json, HashMap.class); String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1);
HashMap map = JSONObject.parseObject(json, HashMap.class);
return new Result().ok(map);
} catch (Exception e) {
e.printStackTrace();
return new Result().error();
}
return new Result().ok(map);
} }
@GetMapping("algorithmPage") @GetMapping("algorithmPage")