| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.javaweb.common.config.Global; |
| | | import com.javaweb.common.config.ServerConfig; |
| | | import com.javaweb.common.utils.IdGenerate; |
| | | 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 org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.javaweb.common.annotation.Log; |
| | | import com.javaweb.common.enums.BusinessType; |
| | | import com.javaweb.geo.domain.ProjectPerson; |
| | |
| | | |
| | | @Autowired |
| | | private IProjectPersonService projectPersonService; |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | @RequiresPermissions("geo:projectPerson:view") |
| | | @GetMapping() |
| | |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(ProjectPerson projectPerson) { |
| | | |
| | | return toAjax(projectPersonService.insertProjectPerson(projectPerson)); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 上传图片 |
| | | */ |
| | | @PostMapping("/uploadImg") |
| | | @PostMapping("/uploadPersonFile") |
| | | @ResponseBody |
| | | public AjaxResult uploadImg(MultipartFile file, HttpServletRequest request){ |
| | | return projectPersonService.uploadImg(file,request); |
| | | public AjaxResult uploadPersonFile(MultipartFile file, HttpServletRequest request){ |
| | | try |
| | | { |
| | | // 上传文件路径 |
| | | String filePath = Global.getUploadPath() +"/personfile"; |
| | | // 上传并返回新文件名称 |
| | | 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()); |
| | | } |
| | | } |
| | | } |