| | |
| | | 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.uuid.UUID; |
| | | import com.ltkj.hosp.domain.SysAttachment; |
| | | 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; |
| | |
| | | private ISysAttachmentService sysAttachmentService; |
| | | @Autowired |
| | | private ISysDictDataService sysDictDataService; |
| | | @Autowired |
| | | private ISysConfigService sysConfigService; |
| | | |
| | | |
| | | /** |
| | |
| | | @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 = sysConfigService.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); |