| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.system.ApplicationHome; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @ApiOperation(value = "更新") |
| | | public Response update(@RequestBody Station3D station3D){ |
| | | service.update(station3D); |
| | | return new Response().setII(1,"更新成功"); |
| | | } |
| | | |
| | | @PutMapping("batch") |
| | | @ApiOperation(value = "更新批量") |
| | | public Response updateBatch(@RequestBody List<Station3D> station3DList){ |
| | | service.updateBatch(station3DList); |
| | | return new Response().setII(1,"更新成功"); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "读取图片") |
| | | public Response pictureLoad(HttpServletRequest request){ |
| | | /*=========图片保存===========*/ |
| | | //获取到tomcat webapp绝对路径 |
| | | String realPath = request.getServletContext().getRealPath("/"); |
| | | //String realPath = ActionUtil.getApplication().getRealPath("/"); |
| | | String[] split = realPath.split("\\\\"); |
| | | String projectName = split[split.length - 1]; |
| | | |
| | | String webAppPath = realPath.substring(0, realPath.lastIndexOf(projectName)); |
| | | |
| | | ApplicationHome applicationHome = new ApplicationHome(getClass()); |
| | | File jarFile = applicationHome.getDir(); |
| | | //存储3D站点图片的文件夹 |
| | | String fileDirName = webAppPath + projectName + "_photo_3DStation"; |
| | | |
| | | //开发 |
| | | String fileDirName = jarFile.getParentFile().toString()+File.separator+"fg_photo_3DStation"; |
| | | //打包 |
| | | //String fileDirName = jarFile.toString()+File.separator+"fg_photo_3DStation"; |
| | | |
| | | //图片的Url |
| | | File file = new File(fileDirName); |
| | | if(file.exists()){ |