| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.javaweb.common.config.Global; |
| | | import com.javaweb.common.config.ServerConfig; |
| | | import com.javaweb.common.utils.file.FileUploadUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import com.javaweb.common.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 材料出入库记录Controller |
| | | * |
| | |
| | | |
| | | @Autowired |
| | | private ITubLogService tubLogService; |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | @RequiresPermissions("geo:TubLog:view") |
| | | @GetMapping() |
| | |
| | | return tubLogService.countTubLogDate(projectId); |
| | | } |
| | | |
| | | /** |
| | | * 上传图片 |
| | | */ |
| | | @PostMapping("/uploadTubLogFile") |
| | | @ResponseBody |
| | | public AjaxResult uploadTubLogFile(MultipartFile file){ |
| | | try { |
| | | // 上传文件路径 |
| | | String filePath = Global.getUploadPath() +"/tublogfile"; |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("url", url); |
| | | return ajax; |
| | | }catch (Exception e){ |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |