public Map<String, Object> sendGrantToCrm(String custNo, String cardNo, String path, String fileName) { FileSystemResource fileSystemResource = new FileSystemResource(path + fileName); MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); Map<String, Object> resultMap = new HashMap<>(); try { InputStream is = new BufferedInputStream(new FileInputStream(path + fileName)); String md5 = DigestUtils.md5Hex(IOUtils.toByteArray(is)); IOUtils.closeQuietly(is); String crmUrl = EurekaServer.CRM + "/app/crm/cust/arch/upload?custNo=" + custNo + "&cardNo=" + cardNo + "&archType=1" + "&fileName=" + fileName + "&md5=" + md5; HttpHeaders headers = new HttpHeaders(); paramMap.add("file", fileSystemResource); HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(paramMap, headers); ResponseEntity entity = restTemplate.exchange(crmUrl, HttpMethod.POST, httpEntity, Map.class); Map<String, Object> crmRetMap = (Map<String, Object>) entity.getBody(); logger.info("授权书发送CRM:entity=" + crmRetMap); if (!"00000".equals(((Map<String, Object>) crmRetMap.get("head")).get("retFlag"))) { resultMap.put("retCod", "00001"); resultMap.put("retMsg", ((Map<String, Object>) entity.getBody()).get("retMsg")); return resultMap; } } catch (Exception e) { logger.error("文件上传CRM异常!" + e.getMessage()); resultMap.put("retCod", "00002"); resultMap.put("retMsg", "文件上传CRM异常!"); return resultMap; } resultMap.put("retCod", "00000"); return resultMap; }