| | |
| | | public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ; |
| | | public static final String HK_ROOTORG_NAME ="HK_ROOTORG_NAME" ; |
| | | public static final String REDIS_TOKEN_KEY = "token_"; |
| | | public static final String CUSTOMER = "CUSTOMER"; |
| | | public static final String BUSINESS = "BUSINESS"; |
| | | |
| | | |
| | | //被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验) |
| | | public static final String ZBOM_CRM_AUTH_API_KEY = "ZBOM_CRM_AUTH_API_KEY"; |
| | |
| | | public static final String WEIXIN_DEFAULT_IMGS = "WEIXIN_DEFAULT_IMGS"; |
| | | public static final String USER_CARD_DEFAULT_IMG = "USER_CARD_DEFAULT_IMG"; |
| | | public static final String USERS_FILE = "USERS_FILE"; |
| | | public static final String SHARES_FILE = "SHARES_FILE"; |
| | | public static final String NEWS_FILE = "NEWS_FILE"; |
| | | public static final String USER_LABEL = "USER_LABEL"; |
| | | //发送会议开始 定时提前多少分钟发送 |
| | |
| | | |
| | | |
| | | public static final String WX_MINI_CONFIG = "WX_MINI_CONFIG"; |
| | | public static final String SHARE_HAIBAO_HEADER_TITLE = "SHARE_HAIBAO_HEADER_TITLE"; |
| | | public static final String WX_APPID_CUSTOMER = "WX_APPID_CUSTOMER"; |
| | | public static final String WX_SECRET_CUSTOMER = "WX_SECRET_CUSTOMER"; |
| | | public static final String WX_APPID_PERSONNEL = "WX_APPID_PERSONNEL"; |
| | | public static final String WX_SECRET_PERSONNEL = "WX_SECRET_PERSONNEL"; |
| | | public static final String WX_TOKEN_CUSTOMER = "WX_TOKEN_CUSTOMER"; |
| | | public static final String WX_TOKEN_PERSONNEL = "WX_TOKEN_PERSONNEL"; |
| | | public static final String ZBOM_CRM_POSTCUS_API_KEY = "ZBOM_CRM_POSTCUS_API_KEY"; |
| | | |
| | | |
| | | public interface RedisKeys { |
| | |
| | | String ZBOM_ENCODE_URL ="ZBOM_ENCODE_URL"; |
| | | String ZBOM_SMS_API_KEY ="ZBOM_SMS_API_KEY"; |
| | | String ZBOM_ZHONGTAI_API_URL ="ZBOM_ZHONGTAI_API_URL"; |
| | | String ZBOM_CRM_POSTCUS_API_KEY ="ZBOM_CRM_POSTCUS_API_KEY"; |
| | | String ZBOM_AREA_REDIS_KEY ="ZBOM_AREA_REDIS_KEY"; |
| | | String ZBOM_SMS_API_URL ="ZBOM_SMS_API_URL"; |
| | | String IAM_APPKEY ="IAM_APPKEY"; |
| | | String SHOP_TREE ="SHOP_TREE"; |
| | |
| | | Response response = client.newCall(request).execute(); |
| | | if (response.isSuccessful()) { |
| | | InputStream inputStream = new ByteArrayInputStream(response.body().bytes()); |
| | | // ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | // byte[] buffer = new byte[1024]; |
| | | // int len = -1; |
| | | // while ((len = inputStream.read(buffer)) != -1) { |
| | | // baos.write(buffer, 0, len); |
| | | // } |
| | | // System.out.println("data:mediatype;base64," + Base64.getEncoder().encodeToString(baos.toByteArray())); |
| | | /* ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int len = -1; |
| | | while ((len = inputStream.read(buffer)) != -1) { |
| | | baos.write(buffer, 0, len); |
| | | } |
| | | System.out.println("data:mediatype;base64," + Base64.getEncoder().encodeToString(baos.toByteArray()));*/ |
| | | return inputStream; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"生成图片失败"); |
| | | return null; |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"生成图片失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送get请求 |
| | | * @param url 请求URL |
| | | * @param param 请求参数 key:value url携带参数 或者无参可不填 |
| | | * @return |
| | | */ |
| | | public static String doGet(String url, Map<String, String> param) { |
| | | // 创建Httpclient对象 |
| | | CloseableHttpClient httpclient = HttpClients.createDefault(); |
| | | String resultString = ""; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | // 创建uri |
| | | URIBuilder builder = new URIBuilder(url); |
| | | if (param != null) { |
| | | for (String key : param.keySet()) { |
| | | builder.addParameter(key, param.get(key)); |
| | | } |
| | | } |
| | | URI uri = builder.build(); |
| | | // 创建http GET请求 |
| | | HttpGet httpGet = new HttpGet(uri); |
| | | // 执行请求 |
| | | response = httpclient.execute(httpGet); |
| | | // 判断返回状态是否为200 |
| | | if (response.getStatusLine().getStatusCode() == 200) { |
| | | resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (response != null) { |
| | | response.close(); |
| | | } |
| | | httpclient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | |
| | | |
| | | |