| | |
| | | |
| | | select c.* from lf.sys_role a inner join lf.sys_role_user b on a.id = b.roleid |
| | | inner join lf.sys_user c on b.userid = c.id |
| | | where a.is_admin = 2 --and a.depid = 38 |
| | | where a.is_admin = 2 and c.depcode = '000204' |
| | | order by c.id limit 1 |
| | | |
| | | select c.* from lf.sys_role a inner join lf.sys_role_user b on a.id = b.roleid |
| | | inner join lf.sys_user c on b.userid = c.id |
| | | where a.is_admin = 2 and a.depid = 1 |
| | | where a.is_admin = 2 and a.depid = 20 |
| | | order by c.id limit 1 |
| | | |
| | | select * from lf.sys_user |
| | | select * from lf.sys_role |
| | | |
| | | select * from lf.sys_download |
| | | |
| | | |
| | | |
| | |
| | | return fail("找不到标绘数据", null); |
| | | } |
| | | |
| | | String guid = markService.downloadShp(ue, list, req, res); |
| | | String guid = markService.downloadShp(ue, list); |
| | | if (StringHelper.isNull(guid)) { |
| | | return fail("生成ShapeFile文件失败", null); |
| | | } |
| | |
| | | /** |
| | | * 获取字段 |
| | | */ |
| | | private static void getFields(Class clazz, List<Field> list) { |
| | | public static void getFields(Class clazz, List<Field> list) { |
| | | try { |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | for (Field f : fields) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | FieldDefn fdName = new FieldDefn("name", ogr.OFTString); |
| | | fdName.SetWidth(50); |
| | | layer.CreateField(fdName, 0); |
| | | |
| | | FieldDefn fdProps = new FieldDefn("props", ogr.OFTString); |
| | | fdProps.SetWidth(1024); |
| | | // layer.DeleteField(layer.FindFieldIndex("name", 1)) |
| | | layer.CreateField(fdProps, 1); |
| | | List<Field> fields = new ArrayList<>(); |
| | | GdbHelper.getFields(MarkJsonEntity.class, fields); |
| | | GdbHelper.addLayerField(layer, fields); |
| | | |
| | | FeatureDefn featureDefn = layer.GetLayerDefn(); |
| | | for (MarkJsonEntity mje : list) { |
| | | Geometry geo = Geometry.CreateFromWkt(mje.getWkt()); |
| | | |
| | | for (MarkJsonEntity t : list) { |
| | | Feature f = new Feature(featureDefn); |
| | | f.SetField(0, mje.getName()); |
| | | //f.SetField(1, mje.getProps()); |
| | | GdbHelper.setFeatureData(f, fields, t); |
| | | |
| | | Geometry geo = Geometry.CreateFromWkt(t.getWkt()); |
| | | f.SetGeometry(geo); |
| | | |
| | | layer.CreateFeature(f); |
| | |
| | | private static int getGeometryType(String type) { |
| | | switch (type) { |
| | | case "POINT": |
| | | return 1; |
| | | return ogr.wkbPoint; |
| | | case "LINESTRING": |
| | | return 2; |
| | | return ogr.wkbLineString; |
| | | case "POLYGON": |
| | | return 3; |
| | | return ogr.wkbPolygon; |
| | | default: |
| | | return -1; |
| | | return ogr.wkbUnknown; |
| | | } |
| | | } |
| | | |
| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.MarkJsonEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param list 标绘JSON实体类集合 |
| | | * @param req 请求 |
| | | * @param res 响应 |
| | | * @return GUID |
| | | * @throws Exception 异常 |
| | | */ |
| | | public String downloadShp(UserEntity ue, List<MarkJsonEntity> list, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | public String downloadShp(UserEntity ue, List<MarkJsonEntity> list) throws Exception { |
| | | String parent = pathHelper.getTempPath(); |
| | | |
| | | String path = createShapeFiles(ue, list, parent); |
| | |
| | | * 获取shp目录 |
| | | */ |
| | | private String getShpDir(UserEntity ue, String parent) { |
| | | String path = parent + File.separator + WebHelper.getRandomInt(100000, 1000000); |
| | | String path = parent + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()); |
| | | |
| | | File file = new File(path); |
| | | if (!file.exists() && !file.isDirectory()) { |
| | |
| | | if (StringHelper.isEmpty(mark.getWkt())) { |
| | | continue; |
| | | } |
| | | if (mark.getWkt().indexOf(type) > -1) { |
| | | if (mark.getWkt().contains(type)) { |
| | | rs.add(mark); |
| | | } |
| | | } |
| | |
| | | public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) { |
| | | String fileName = null; |
| | | for (MetaFileEntity mf : list) { |
| | | if (mf.getName().toLowerCase().contains(".shp")) { |
| | | if (mf.getName().toLowerCase().contains(StaticData.SHP)) { |
| | | fileName = mf.getPath(); |
| | | break; |
| | | } |