kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java
@@ -36,4 +36,12 @@ @PostMapping(value = "/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam("imgType") String imgType); /** * base64上传图片 * @param file,imgType * @param imgType 文件类型:X光片/医院Logo[Xray/Logo] */ @PostMapping(value = "/baseUplaod",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) FileInfo baseUplaod(@RequestParam("file") String file,@RequestParam("imgType") String imgType); } kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/fallback/FileServiceFallbackFactory.java
@@ -33,6 +33,10 @@ public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) { return null; } @Override public FileInfo baseUplaod(String file, String imgType) { return null; } }; } } kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-biz/src/main/java/com/kidgrow/filecenter/service/IFileService.java
@@ -32,4 +32,8 @@ * @throws Exception */ FileInfo uploadForThumbnails(MultipartFile file ,String imgType) throws Exception; /** * base64上传图片 */ FileInfo baseUplaod(String file, String imgType); } kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-biz/src/main/java/com/kidgrow/filecenter/service/impl/AbstractIFileService.java
@@ -1,6 +1,7 @@ package com.kidgrow.filecenter.service.impl; import cn.hutool.core.util.IdUtil; import com.aliyun.oss.model.ObjectMetadata; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.kidgrow.common.constant.CommonConstant; @@ -16,14 +17,15 @@ import lombok.extern.slf4j.Slf4j; import net.coobird.thumbnailator.Thumbnails; import org.apache.commons.collections4.MapUtils; import org.springframework.http.MediaType; import org.springframework.web.multipart.MultipartFile; import sun.misc.BASE64Decoder; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.*; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; /** * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> @@ -171,5 +173,41 @@ return fileInfo; } } @Override public FileInfo baseUplaod(String file, String imgType) { if(file==null||"".equals(file.trim())){ return null; } String name=file.split(",")[0]; file = file.split(",")[1]; BASE64Decoder decoder = new BASE64Decoder(); try { byte[] bytes = decoder.decodeBuffer(file); ObjectMetadata objectMeta = new ObjectMetadata(); objectMeta.setContentLength(file.length()); //将字节码转换成流 InputStream input = new ByteArrayInputStream(bytes); String fileName= UUID.randomUUID().toString().replaceAll("-",""); //image/jpeg;base64 String newFileName=fileName+"."+name.substring(name.lastIndexOf("/")+1,name.lastIndexOf(";")); FileInfo newfileInfo=new FileInfo(); newfileInfo.setName(newFileName); newfileInfo.setId(IdUtil.fastSimpleUUID()); newfileInfo.setSize(file.length()); newfileInfo.setIsImg(true); newfileInfo.setContentType("image/jpeg"); newfileInfo.setSource("aliyun"); newfileInfo.setImgType(imgType); newfileInfo.setCreateTime(new Date()); this.fileUpLoadOss(newfileInfo,"HospitalLogo/"+newFileName,input); input.close(); baseMapper.insert(newfileInfo); return newfileInfo; } catch (IOException e) { e.printStackTrace(); } return null; } } kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
@@ -61,6 +61,13 @@ public FileInfo thUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception { return fileService.uploadForThumbnails(file,imgType); } /** * base64上传图片 */ @PostMapping(value="baseUplaod",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public FileInfo baseUplaod(@RequestParam("file") String file,@RequestParam("imgType") String imgType){ return fileService.baseUplaod(file,imgType); } /** * 文件删除 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysFeedbackServiceImpl.java
@@ -83,19 +83,6 @@ if (sysFeedback.getId()==null) { List<SysOrganization> organizations = sysUser.getOrganizations(); if (organizations.size() > 0) { // sysFeedback.setDepartmentId(organizations.get(1).getId()); // sysFeedback.setDepartmentName(organizations.get(1).getOrgName()); // sysFeedback.setHospitalId(organizations.get(0).getId()); // sysFeedback.setHospitalName(organizations.get(0).getOrgName()); // Map map = new HashMap(); // map.put("user_id", sysUser.getId()); // ResultBody listByMap = sysDoctorService.getListByMap(map); // List<SysDoctor> sysDoctors = JSON.parseArray(JSON.toJSONString(listByMap.getData()), SysDoctor.class); // if (sysDoctors.size() > 0) { // sysFeedback.setDoctorId(sysDoctors.get(0).getId()); // sysFeedback.setDoctorName(sysDoctors.get(0).getDoctorName()); // sysFeedback.setDoctorTel(sysDoctors.get(0).getDoctorTel()); // } int insert = baseMapper.insert(sysFeedback); if (insert > 0) { return true; kidgrow-springcloud/kidgrow-springcloud-zuul/src/main/resources/application.yml
@@ -163,6 +163,12 @@ strip-prefix: true sensitive-headers: '*' custom-sensitive-headers: true api-evaluation: path: /api-evaluation/** service-id: boneage-evaluationcenter-server strip-prefix: true sensitive-headers: '*' custom-sensitive-headers: true ssl-hostname-validation-enabled: false @@ -208,6 +214,7 @@ - /api-user/users/doctorUserReg - /api-user/users/isRegUser - /api-user/users/passwordByPhone - /api-evaluation/evaluationxrayinfo/appUpload # - /api-user/syshospital/findAllByMap # - /api-user/sysdictionaries/findAll # - /api-user/sysdepartment/findListByHospitalId @@ -236,7 +243,8 @@ /api-user/users/doctorUserReg, /api-file/files-upload, /api-user/users/isRegUser, /api-user/users/passwordByPhone /api-user/users/passwordByPhone, /api-evaluation/evaluationxrayinfo/appUpload # /api-user/syshospital/findAllByMap, # /api-user/sysdictionaries/findAll, # /api-user/sysdepartment/findListByHospitalId