易企秀怎么做网站,单页设计网站,免费网址域名注册,可以上传数据的网站开发后端 后端是在使用activiti7时#xff0c;一个查询了部署了的流程图#xff0c;对应的一个存在数据库中#xff0c;数据类型为blob类型的值的这么一个接口 /*** 根据流程定义id查看流程图(xml或者图片)**/GetMapping(value /selectPicture)public AjaxResult g…后端 后端是在使用activiti7时一个查询了部署了的流程图对应的一个存在数据库中数据类型为blob类型的值的这么一个接口 /*** 根据流程定义id查看流程图(xml或者图片)**/GetMapping(value /selectPicture)public AjaxResult getFlowChart(String processDefinitionId) {String resTypexml;HttpHeaders headers new HttpHeaders();if (xml.equals(resType)) {//xml格式headers.setContentType(MediaType.APPLICATION_XML);} else {//image 图片格式headers.setContentType(MediaType.IMAGE_PNG);}//获取流程定义信息ProcessDefinition processDefinition repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();String resourceName ;if (image.equals(resType)) {resourceName processDefinition.getDiagramResourceName();} else if (xml.equals(resType)) {resourceName processDefinition.getResourceName();}InputStream resourceAsStream repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);return AjaxResult.success(成功,IoUtil.readBytes(resourceAsStream));}前端 如果你想解析后台传来的 Blob 并得到其中的字符串并且其中的中文不能乱码你可以使用以下步骤 1.使用 atob() 函数将 Blob 转换为 base64 字符串。
2.使用 iconv 库将 base64 字符串转换为 UTF-8 字符串。
npm install iconv-lite --saveselectPicture(data) {let _thisthis;selectPicture(data.id).then(res {if (res.code 200) {const decodedData atob(res.data);const daiconv.decode(decodedData,UTF-8)_this.$router.push({name: selectprocces,params: {da: da}})}})}