| | |
| | | select id,cn_name,elev from lf.sys_layer where cn_name in ('火车站','地下管线','中卫站','庆阳站','地层示例'); |
| | | |
| | | select * from lf.sys_dir where pid=0 order by code; |
| | | select * from lf.sys_meta order by id desc; |
| | | |
| | | |
| | | |
| | | select gid, pipename, segname, ST_AsText(ST_LineMerge(geom)) "wkt" |
| | | from bs.m_pipesegment |
| | | where pipename is not null and not ST_IsEmpty(geom) |
| | | order by pipename, segname; |
| | | |
| | | |
| | | |
| | |
| | | import com.lf.server.entity.ctrl.MarkJsonEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.show.PipelineEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.show.MarkService; |
| | | import com.lf.server.service.show.PipelineService; |
| | | import com.lf.server.service.sys.DownlogService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | DownloadService downloadService; |
| | | |
| | | @Autowired |
| | | PipelineService pipelineService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询管线") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "西气东输"), |
| | | }) |
| | | @GetMapping(value = "/selectPipelines") |
| | | public ResponseMsg<Object> selectPipelines(String name) { |
| | | try { |
| | | List<PipelineEntity> rs = pipelineService.selectPipelines(name); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询路网") |
| | | @ApiImplicitParams({ |
| | |
| | | }) |
| | | @GetMapping(value = "/download") |
| | | public void download(String guid, HttpServletResponse res) { |
| | | uploadAttachService.download(guid, res); |
| | | uploadAttachService.download(guid, false, res); |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查看下载文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "guid", value = "附件Guid", dataType = "String", paramType = "body") |
| | | }) |
| | | @GetMapping(value = "/downloadForView") |
| | | public void downloadForView(String guid, HttpServletResponse res) { |
| | | uploadAttachService.download(guid, true, res); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 下载文件 |
| | | */ |
| | | public static void download(String file, String fileName, HttpServletResponse res) throws Exception { |
| | | download(file, fileName, res); |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * |
| | | * @param file 文件 |
| | | * @param fileName 文件名 |
| | | * @param res 响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static void download(String file, String fileName, HttpServletResponse res) throws Exception { |
| | | public static void download(String file, String fileName, boolean inline, HttpServletResponse res) throws Exception { |
| | | if (StringHelper.isEmpty(fileName)) { |
| | | fileName = StringHelper.YMDHMS2_FORMAT.format(new Date()); |
| | | } |
| | | fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); |
| | | String dispose = inline ? "inline" : "attachment"; |
| | | |
| | | // 设置响应头中文件的下载方式为附件方式,以及设置文件名 |
| | | res.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + fileName); |
| | | res.setHeader("Content-Disposition", dispose + "; filename*=UTF-8''" + fileName); |
| | | // 设置响应头的编码格式为 UTF-8 |
| | | res.setCharacterEncoding("UTF-8"); |
| | | |
| | |
| | | /** |
| | | * 删除多条 |
| | | * |
| | | * @param sql |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deletes(List<Integer> ids); |
| | | public Integer deletes(String sql, String ids); |
| | | |
| | | /** |
| | | * 更新一条 |
| | |
| | | @Repository |
| | | public interface PipelineMapper { |
| | | /** |
| | | * 查询管道 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public List<PipelineEntity> selectPipelines(String name); |
| | | |
| | | /** |
| | | * 查询管段 |
| | | * |
| | | * @return 管线实体类集合 |
| | |
| | | * 下载文件 |
| | | */ |
| | | public void download(String guid, HttpServletResponse res) { |
| | | download(guid, res); |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | */ |
| | | public void download(String guid, boolean inline, HttpServletResponse res) { |
| | | try { |
| | | if (StringHelper.isEmpty(guid)) { |
| | | WebHelper.write2Page(res, NO_FILE); |
| | |
| | | } |
| | | |
| | | String file = pathHelper.getConfig().getUploadPath() + File.separator + entity.getPath(); |
| | | WebHelper.download(file, entity.getName(), res); |
| | | WebHelper.download(file, entity.getName(), inline, res); |
| | | } catch (Exception ex) { |
| | | try { |
| | | String msg = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.ERROR, "文件下载出错")); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer deletes(List<Integer> ids) { |
| | | String idStrs = StringHelper.join(ids, ","); |
| | | |
| | | return metaMapper.deletes(ids); |
| | | public Integer deletes(String sql, String ids) { |
| | | return metaMapper.deletes(sql, ids); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public Integer updates(List<MetaEntity> list) { |
| | | return metaMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * 删除元数据 |
| | | */ |
| | | public Integer deletes(List<Integer> list) { |
| | | String ids = StringHelper.join(list, ","); |
| | | String sql = null; |
| | | |
| | | return deletes(sql, ids); |
| | | } |
| | | } |
| | |
| | | private final static Log log = LogFactory.getLog(PipelineService.class); |
| | | |
| | | @Override |
| | | public List<PipelineEntity> selectPipelines(String name) { |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return pipelineMapper.selectPipelines(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<PipelineEntity> selectSegNames() { |
| | | return pipelineMapper.selectSegNames(); |
| | | } |
| | |
| | | /** |
| | | * 设置图层数据 |
| | | */ |
| | | private static void setLayerData(Layer layer, List<Field> fields, List<PipelineEntity> list) throws Exception { |
| | | private static void setLayerData(Layer layer, List<Field> fields, List<PipelineEntity> list) throws Exception { |
| | | for (PipelineEntity t : list) { |
| | | Feature f = new Feature(layer.GetLayerDefn()); |
| | | |
| | |
| | | </insert> |
| | | |
| | | <delete id="deletes"> |
| | | <if test="sql != null"> |
| | | ${sql}; |
| | | </if> |
| | | delete from lf.sys_meta where id in (${ids}); |
| | | </delete> |
| | | |
| | | <delete id="deletes_old"> |
| | | delete from lf.sys_meta where id in |
| | | <foreach item="id" collection="ids" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.show.PipelineMapper"> |
| | | <select id="selectPipelines" resultType="com.lf.server.entity.show.PipelineEntity"> |
| | | select gid, pipename, segname, ST_AsText(ST_LineMerge(geom)) "wkt" |
| | | from bs.m_pipesegment |
| | | <where> |
| | | pipename is not null and not ST_IsEmpty(geom) |
| | | <if test="name != null"> |
| | | and (pipename like #{name} or segname like #{name}) |
| | | </if> |
| | | </where> |
| | | order by pipename, segname; |
| | | </select> |
| | | |
| | | <select id="selectSegNames" resultType="com.lf.server.entity.show.PipelineEntity"> |
| | | select gid, pipename, segname from bs.m_pipesegment order by pipename, segname; |
| | | </select> |