| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.core.domain.R; |
| | | import com.ltkj.common.core.domain.entity.SysDictData; |
| | | import com.ltkj.common.utils.SnowFlake; |
| | | import com.ltkj.common.utils.uuid.UUID; |
| | | import com.ltkj.hosp.domain.SysAttachment; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.hosp.service.ISysAttachmentService; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDictDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | @Value("${path.xdtfilePath}") |
| | | private String value; |
| | | // @Value("${path.xdtfilePath}") |
| | | // private String value; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | |
| | | private ISysAttachmentService sysAttachmentService; |
| | | @Autowired |
| | | private ISysDictDataService sysDictDataService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private TestMapper testMapper; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * exe上传图片接口 |
| | | * @param file |
| | | * @param dictVal |
| | | * @param ip |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadImgExe") |
| | | @ApiOperation(value = "EXE程序循环读取图片上传") |
| | | public AjaxResult uploadImgExe(@RequestPart("file") MultipartFile file,@RequestParam("val")String dictVal,@RequestParam("ip")String ip){ |
| | | if (StrUtil.isBlank(dictVal)) |
| | | return AjaxResult.error("类型不能为空"); |
| | | try { |
| | | String exeimgsaveurl = configService.selectConfigByKey("exeimgsaveurl"); |
| | | String filePath; |
| | | if (StrUtil.isNotBlank(exeimgsaveurl)){ |
| | | filePath = exeimgsaveurl; |
| | | }else { |
| | | filePath = ltkjConfig.getUploadPath(); |
| | | } |
| | | // 上传文件路径 |
| | | String filePath = ltkjConfig.getUploadPath(); |
| | | |
| | | filePath+="/"+dictVal; |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | |
| | | ajax.put("newFileName", newFileName); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | SysAttachment sysAttachment = new SysAttachment(); |
| | | sysAttachment.setOldFileName(file.getOriginalFilename()); |
| | | sysAttachment.setId(SnowFlake.getInstance().nextId()); |
| | | sysAttachment.setFileName(newFileName); |
| | | sysAttachment.setFilePath(fileName); |
| | | sysAttachment.setFilePath(ltkjConfig.getUploadPath()+fileName.replace("/profileupload","")); |
| | | sysAttachment.setUrl(url); |
| | | sysAttachment.setSysDictVal(dictVal); |
| | | sysAttachment.setIp(ip); |
| | |
| | | e.printStackTrace(); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取exe程序上传图片列表 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @GetMapping("/getExeUploadImgList") |
| | | public AjaxResult getExeUploadImgList(@RequestParam("type") String type){ |
| | | if (StrUtil.isBlank(type)) return AjaxResult.error("类型不能为空"); |
| | | List<Map<String, Object>> list = testMapper.getExeUploadImgListByGnLx(type); |
| | | return AjaxResult.success().put("data",list); |
| | | } |
| | | |
| | | @GetMapping("/listExeVal") |
| | |
| | | @ApiParam("体检号") String tjh,@ApiParam("项目id") String proId) throws Exception { |
| | | try { |
| | | // 上传文件路径 |
| | | String value = configService.selectConfigByKey("path_xdtfilePath"); |
| | | String filePath = value + File.separator; |
| | | String outputFileName = tjh +"_" +proId; |
| | | // 上传并返回新文件名称 |