| | |
| | | HttpURLConnection connection = null; |
| | | OutputStream outputStream = null; |
| | | String rs = ""; |
| | | ShjdjwRespDto responseDto; |
| | | ShjdjwRespDto responseDto = null; |
| | | try { |
| | | connection = (HttpURLConnection) urls.openConnection(); |
| | | connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); |
| | |
| | | rs = null; |
| | | return new ShjdjwRespDto(99,e.getMessage()); |
| | | } |
| | | log.info("---------接口返回:" + rs +"---------"); |
| | | if(StringUtils.isEmpty(rs)){ |
| | | if(StringUtils.isNotEmpty(rs)){ |
| | | rs = rs.replaceAll("\"", ""); |
| | | log.info("---------接口返回,秘文:" + rs +"---------"); |
| | | rs = AESUtils.decrypt(rs, apiConfs.getPublicKey()); |
| | | log.info("---------接口返回,解析后:" + rs +"---------"); |
| | | responseDto = JSON.parseObject(rs, ShjdjwRespDto.class); |
| | | } |
| | | if(responseDto == null ) { |
| | | return new ShjdjwRespDto(99,"接口请求发生未知错误"); |
| | | } |
| | | if("dDTJ5xGqsmo32r40WKKPOLW6ORtH3mwMyv4YaJNzc4g=".equals(rs)){ |
| | | return new ShjdjwRespDto(1,"上报成功"); |
| | | } |
| | | // responseDto = JSON.parseObject(rs, ShjdjwRespDto.class); |
| | | return new ShjdjwRespDto(1,"上报成功"); |
| | | return responseDto; |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |