| | |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.utils.DateUtil; |
| | | import com.kidgrow.common.utils.MultipartFileUtils; |
| | | import com.kidgrow.common.utils.RandomValueUtils; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.filecenter.mapper.FileMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.coobird.thumbnailator.Thumbnails; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import sun.misc.BASE64Decoder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | | import java.io.*; |
| | |
| | | */ |
| | | protected abstract void uploadFile(MultipartFile file, FileInfo fileInfo) throws Exception; |
| | | protected abstract void fileUpLoadOss(FileInfo fileInfo,String newFilePath, InputStream fileStream); |
| | | protected abstract String FilePath(String imgType,String folderByDate); |
| | | protected abstract String FilePath(String imgType,String folderByDate,String hospitalId,String departmentId); |
| | | protected abstract OSSObject down(String url); |
| | | |
| | | /** |
| | |
| | | //将生成的文件转换为流 |
| | | InputStream inputStream=new FileInputStream(thuFile); |
| | | String folderByDate = DateUtil.formatDate(new Date()); |
| | | String filefloder=this.FilePath(imgType,folderByDate); |
| | | String filefloder=this.FilePath(imgType,folderByDate,null,null); |
| | | FileInfo newfileInfo=new FileInfo(); |
| | | newfileInfo.setName(newFileName); |
| | | newfileInfo.setId(IdUtil.fastSimpleUUID()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FileInfo baseUplaod(String file, String imgType) { |
| | | public FileInfo baseUplaod(String file, String imgType, String hospitalId, String departmentId) { |
| | | if(file==null||"".equals(file.trim())){ |
| | | return null; |
| | | } |
| | |
| | | newfileInfo.setSource("aliyun"); |
| | | newfileInfo.setImgType(imgType); |
| | | newfileInfo.setCreateTime(new Date()); |
| | | this.fileUpLoadOss(newfileInfo,"HospitalLogo/"+newFileName,input); |
| | | String folderByDate =DateUtil.formatDate(new Date()); |
| | | String filePath = FilePath(imgType, folderByDate, hospitalId, departmentId); |
| | | this.fileUpLoadOss(newfileInfo,filePath+newFileName,input); |
| | | input.close(); |
| | | baseMapper.insert(newfileInfo); |
| | | return newfileInfo; |