当前位置: 首页 > news >正文

门户网站软文网站建设的教学设计

门户网站软文,网站建设的教学设计,怎样在工商局网站做公示,网站转回国内一、生成微信小程序二维码 微信官网API文档 1.下载到本地 Overridepublic String getWxRemovalCode() {String appId 微信小程序AppID;String secret 微信小程序AppSecret;//获取凭证String token weiXinService.getAccessToken(appId, secret);Ma…一、生成微信小程序二维码 微信官网API文档 1.下载到本地 Overridepublic String getWxRemovalCode() {String appId 微信小程序AppID;String secret 微信小程序AppSecret;//获取凭证String token weiXinService.getAccessToken(appId, secret);MapString, Object params new HashMap();//前端页面需要的数据params.put(scene, value);//扫码后进入小程序的页面位置params.put(page, https://argentian.com.cn/home/home); //不是必须需要的宽度默认430x430最小280最大1280params.put(width, 280);//默认是false是否需要透明底色为 true 时生成透明底色的小程序params.put(is_hyaline, true);CloseableHttpClient httpClient HttpClientBuilder.create().build();HttpPost httpPost new HttpPost(https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token token);httpPost.addHeader(HTTP.CONTENT_TYPE, application/json);String body JSON.toJSONString(params);//必须是json模式的 postStringEntity entity null;try {InputStream inputStream null;try {entity new StringEntity(body);entity.setContentType(image/png);httpPost.setEntity(entity);HttpResponse response;response httpClient.execute(httpPost);inputStream response.getEntity().getContent();String path D:\\\\picture\\wx;//文件路径//生成图片文件File file new File(path);//如果文件夹不存在就创建文件夹if (!file.exists()) {file.mkdirs();}OutputStream os null;try {os new FileOutputStream(file \\文件名);int len 0;byte[] buffer new byte[8192];while ((len inputStream.read(buffer)) ! -1) {os.write(buffer, 0, len);}} finally {os.close();inputStream.close();}} catch (Exception e) {e.printStackTrace();return 生成失败;}} catch (Exception e) {e.printStackTrace();return 生成失败;}}return 生成微信小程序二维码成功;}2.存到图片服务器实例阿里云图片服务器 Overridepublic String getWxRemovalCode() {String appId 微信小程序AppID;String secret 微信小程序AppSecret;//获取凭证String token weiXinService.getAccessToken(appId, secret);MapString, Object params new HashMap();//前端页面需要的数据params.put(scene, value);//扫码后进入小程序的页面位置params.put(page, https://argentian.com.cn/home/home); //不是必须需要的宽度默认430x430最小280最大1280params.put(width, 280);//默认是false是否需要透明底色为 true 时生成透明底色的小程序params.put(is_hyaline, true);CloseableHttpClient httpClient HttpClientBuilder.create().build();HttpPost httpPost new HttpPost(https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token token);httpPost.addHeader(HTTP.CONTENT_TYPE, application/json);String body JSON.toJSONString(params);//必须是json模式的 postStringEntity entity null;try {InputStream inputStream null;try {entity new StringEntity(body);entity.setContentType(image/png);httpPost.setEntity(entity);HttpResponse response;response httpClient.execute(httpPost);inputStream response.getEntity().getContent();Date date new Date();Long timestamp date.getTime();String fileName timestamp.toString() .png;//文件名//生成图片文件File file new File(fileName );OutputStream os null;try {os new FileOutputStream(file);int len 0;byte[] buffer new byte[8192];while ((len inputStream.read(buffer)) ! -1) {os.write(buffer, 0, len);}} finally {os.close();inputStream.close();}//转成文件格式DiskFileItem fileItem (DiskFileItem) new DiskFileItemFactory().createItem(file,MediaType.ALL_VALUE, true, file.getName());try (InputStream input new FileInputStream(file); OutputStream os fileItem.getOutputStream()) {IOUtils.copy(input, os);} catch (Exception e) {throw new IllegalArgumentException(Invalid file: e, e);}MultipartFile multipartFile new CommonsMultipartFile(fileItem);//调用阿里云静态方法上传到阿里云服务器并返回图片地址String url FileUpload.aliyunUpload(multipartFile);return url;} catch (Exception e) {e.printStackTrace();}} catch (Exception e) {e.printStackTrace();}return 操作失败;}public static String aliyunUpload(MultipartFile myFile) {// 上传路径String dateString DateUtil.getDate(new Date(), DateUtil.YYYYMMDD);String oldFileName myFile.getOriginalFilename();if(!oldFileName.contains(.)){oldFileNamemyFile.getName();}String objectName dateString SLASH UUID.randomUUID().toString().replaceAll(-, ) oldFileName.substring(oldFileName.lastIndexOf(.));// 创建OSSClient实例。OSS ossClient new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);try {InputStream inputStream myFile.getInputStream();ObjectMetadata meta new ObjectMetadata();meta.setContentType(image/jpg);// 创建PutObject请求。ossClient.putObject(bucketName, objectName, inputStream, meta);} catch (Exception oe) {} finally {if (ossClient ! null) {ossClient.shutdown();}}//访问图片路径String urlPrefix argentian;//前缀return urlPrefix objectName;}二、生成支付宝小程序二维码 支付宝官方API文档 Override public String getZfbRemovalCode(HttpServletResponse response2) {String appId 支付宝小程序appId;String privateKey 应用私钥;String alipayPublicKey 支付宝公钥;AlipayClient alipayClient new DefaultAlipayClient(https://openapi.alipay.com/gateway.do,appId, privateKey, json, UTF-8, alipayPublicKey, RSA2);AlipayOpenAppQrcodeCreateRequest request new AlipayOpenAppQrcodeCreateRequest();AlipayOpenAppQrcodeCreateModel model new AlipayOpenAppQrcodeCreateModel();model.setUrlParam(/pages/home/home);model.setDescribe(小程序二维码);//自定义数据 keyvaluemodel.setQueryParam(key value);request.setBizModel(model);AlipayOpenAppQrcodeCreateResponse response alipayClient.execute(request);if (response.isSuccess()) {//获取响应数据里面的蓝底圆码链接地址String url response.getQrCodeUrlCircleBlue();//将普通下载到本地指定文件夹下String imageUrl downloadWithUrl(url, response2);//裁剪图片生成的二维码下放有 “打开支付宝[扫一扫]” 文字描述将文字描述裁剪掉cutOutImage(imageUrl, 裁剪后本地存放路径,裁剪后文件名 , 14, 14, 270, 270);}} catch (AlipayApiException e) {log.error(AlipayApiException:, e);} catch (Exception e) {log.error(AdminException:, e);}}return 生成支付宝二维码成功;}/*** 通过URL下载文件*/public String downloadWithUrl(String path, HttpServletResponse response) throws IOException {//设置响应参数response.setCharacterEncoding(UTF-8);response.setContentType(multipart/form-data);//response.setHeader(Content-Disposition, attachment; filename fileName);//使用此会导致中文变“_”下划线response.setHeader(Content-Disposition, attachment; filename new String(fileName.getBytes(), iso-8859-1));InputStream is null;OutputStream os null;;String filePath ;//文件路径//生成图片文件File file new File(filePath );if (!file.exists()) {file.mkdirs();}try {//创建数据流执行下载URL url new URL(path);is url.openStream();os new FileOutputStream(file \\文件名);byte[] bytes IOUtils.toByteArray(is);os.write(bytes);return file \\文件名;} finally {if (null ! os)os.close();if (null ! is)is.close();}}/*** 图片裁剪** param imagePath 图片地址* param outputDir 临时目录* param name 文件名* param startX 裁剪起始x坐标* param startY 裁剪起始y坐标* param weight 裁剪宽度* param height 裁剪高度* throws Exception 异常*/public static String cutOutImage(String imagePath,String outputDir,String name,Integer startX,Integer startY,Integer weight,Integer height)throws Exception {ListString paths Splitter.on(.).splitToList(imagePath);String ext paths.get(paths.size() - 1);if (!Arrays.asList(png, jpg).contains(ext)) {throw new Exception(format error);}//生成文件名String resultPath Joiner.on(File.separator).join(Arrays.asList(outputDir, IdUtil.simpleUUID() . ext));//自定义文件名String path outputDir \\ name;String ffmpeg Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);ProcessBuilder builder new ProcessBuilder(ffmpeg,-i,imagePath,-vf,MessageFormat.format(crop{0}:{1}:{2}:{3},String.valueOf(weight),String.valueOf(height),String.valueOf(startX),String.valueOf(startY)),-y,path//生成文件名or自定义文件名);builder.inheritIO().start().waitFor();return path;}
http://www.hkea.cn/news/14572118/

相关文章:

  • 第三方网站流量统计抖音代运营话术
  • 论坛型网站开发门户类型网站有哪些
  • 建设银行网站信任河南建设厅网站地址
  • iis5.1 建立网站太原百度seo排名软件
  • 网站收录不好排名高网站点击换图片的效果怎么做
  • 建设网站如何索要素材互联网公司排名全球
  • 用dw制作网站模板下载wordpress 查看文章id
  • 论文网站建设格式thinkphp网站建设
  • 网站开发需要哪些资料网叶制作
  • seo型网站建筑人才网站哪个比较好
  • 网站建设公司怎么做业务十大免费excel网站
  • 西安网站seo技术写一个小程序大概要多少钱
  • 咸阳免费做网站公司机械设计软件solidworks
  • 杭州公司网站建设青岛手机建站公司
  • 网站开发毕设开题报告怎么写深圳住房和建设局网站网上预约
  • 珠海自适应网站建设推拿网站制作
  • 深圳罗湖网站设计wordpress 帝国cms速度
  • node.js做网站开发哪个网站的邮箱最好
  • 怎么用源码做网站视频昆明关键词优化软件
  • 射阳做网站多少钱个人做网站的必要性
  • 山东网站建设方案制作wordpress 园林模板
  • 柳江企业网站建设公司中国空间站设计在轨飞行几年
  • 杭州e时代网站建设让Wordpress只支持手机访问
  • 西安网站建设hyk123洪梅东莞网站建设
  • 制作网站问题和解决方法网站平台设计
  • 小企业网站建设的大品牌wordpress 会员下载
  • 北京高端网站建设优势做字网站
  • 苏州市住房和城乡建设局网站首页app设计网站模板
  • 广东网站设计公司建网站怎么选择服务器
  • 网站搭建策略与方法有哪些方面电子商务网站建设人才调研