|  | @ -3,13 +3,11 @@ package com.yihu.jw.hospital.endpoint.file_upload;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.file_upload.FileUploadService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.wlyy.service.WlyyBusinessService;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
	
		
			
				|  | @ -18,7 +16,10 @@ import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.InputStream;
 | 
	
	
		
			
				|  | @ -50,10 +51,20 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |     @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
 | 
	
		
			
				|  |  |     public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
 | 
	
		
			
				|  |  |                                        @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
 | 
	
		
			
				|  |  |         // 得到文件的完整名称  xxx.txt
 | 
	
		
			
				|  |  |         String originalFilename = file.getOriginalFilename();
 | 
	
		
			
				|  |  |         InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  |         UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
 | 
	
		
			
				|  |  |         UploadVO uploadVO = new UploadVO();
 | 
	
		
			
				|  |  |         if (isClose.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             // 得到文件的完整名称  xxx.txt
 | 
	
		
			
				|  |  |             String originalFilename = file.getOriginalFilename();
 | 
	
		
			
				|  |  |             InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  |             uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
 | 
	
		
			
				|  |  |         }else if(isClose.equals("2")){
 | 
	
		
			
				|  |  |             //内网上传
 | 
	
		
			
				|  |  |             String rs = fileUploadService.request(remote_inner_url,file,null);
 | 
	
		
			
				|  |  |             logger.info(rs);
 | 
	
		
			
				|  |  |             JSONObject json = JSON.parseObject(rs);
 | 
	
		
			
				|  |  |             uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return success("上传成功", uploadVO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -62,9 +73,19 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |     @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
 | 
	
		
			
				|  |  |     public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
 | 
	
		
			
				|  |  |                                        @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
 | 
	
		
			
				|  |  |         String originalFilename = file.getOriginalFilename();
 | 
	
		
			
				|  |  |         InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  |         UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
 | 
	
		
			
				|  |  |         UploadVO uploadVO = new UploadVO();
 | 
	
		
			
				|  |  |         if (isClose.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             String originalFilename = file.getOriginalFilename();
 | 
	
		
			
				|  |  |             InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  |             uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
 | 
	
		
			
				|  |  |         }else if(isClose.equals("2")){
 | 
	
		
			
				|  |  |             //内网上传
 | 
	
		
			
				|  |  |             String rs = fileUploadService.request(remote_inner_url,file,null);
 | 
	
		
			
				|  |  |             logger.info(rs);
 | 
	
		
			
				|  |  |             JSONObject json = JSON.parseObject(rs);
 | 
	
		
			
				|  |  |             uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return success("上传成功", uploadVO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -104,6 +125,7 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |     @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
 | 
	
		
			
				|  |  |     public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
 | 
	
		
			
				|  |  |                                              @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
 | 
	
		
			
				|  |  |         return success("上传成功", uploadVO);
 | 
	
		
			
				|  |  |     }
 |