|  | @@ -165,86 +165,86 @@ public class Fxfw2SdeUtils {
 | 
	
		
			
				|  |  |       * @throws IOException
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public static RequestResult fzxzvector2Sde(FzxzDTO fzxzDTO, String rwlx) throws IOException {
 | 
	
		
			
				|  |  | -        Integer fwlx = fzxzDTO.getFwlx();
 | 
	
		
			
				|  |  | -        rwlx = StringUtils.isEmpty(rwlx) ? "辅助选址" : rwlx;
 | 
	
		
			
				|  |  | -        String vectorFilePath = "";
 | 
	
		
			
				|  |  | -        String pyResult = "";
 | 
	
		
			
				|  |  | -        if (fxfwDictDTO.getRegion().equals(fwlx)) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        } else if (fxfwDictDTO.getDraw().equals(fwlx)) {//自定义绘制范围
 | 
	
		
			
				|  |  | -            EsriJsonModel esriModel = new EsriJsonModel();
 | 
	
		
			
				|  |  | -            //字段汉化
 | 
	
		
			
				|  |  | -            Map<String, String> fieldAliases = new HashMap<>();
 | 
	
		
			
				|  |  | -            fieldAliases.put("RWBSM", "RWBSM");
 | 
	
		
			
				|  |  | -            fieldAliases.put("RWLX", "RWLX");
 | 
	
		
			
				|  |  | -            esriModel.setFieldAliases(fieldAliases);
 | 
	
		
			
				|  |  | -            //geojson绘制范围转换
 | 
	
		
			
				|  |  | -            JSONObject geojson = new JSONObject(JSON.parseObject(fzxzDTO.getXzfw()));
 | 
	
		
			
				|  |  | -            Geometry geom = (Geometry) JSONObject.toJavaObject(geojson, Geometry.class);
 | 
	
		
			
				|  |  | -            //字段信息
 | 
	
		
			
				|  |  | -            List<EsriField> fields = new ArrayList<EsriField>();
 | 
	
		
			
				|  |  | -            fields.add(new EsriField().init("RWBSM", "RWBSM"));
 | 
	
		
			
				|  |  | -            fields.add(new EsriField().init("RWLX", "RWLX"));
 | 
	
		
			
				|  |  | -            esriModel.setFields(fields);
 | 
	
		
			
				|  |  | -            //要素
 | 
	
		
			
				|  |  | -            List<EsriFeature> features = new ArrayList<>();
 | 
	
		
			
				|  |  | -            EsriFeature feature = new EsriFeature();
 | 
	
		
			
				|  |  | -            Map<String, Object> attributes = new HashMap<>();
 | 
	
		
			
				|  |  | -            attributes.put("RWBSM", fzxzDTO.getBsm());
 | 
	
		
			
				|  |  | -            attributes.put("RWLX", rwlx);
 | 
	
		
			
				|  |  | -            feature.setAttributes(attributes);
 | 
	
		
			
				|  |  | -            EsriGeometry geometry = new EsriGeometry();
 | 
	
		
			
				|  |  | -            geometry.setRings(geom.getCoordinates());
 | 
	
		
			
				|  |  | -            feature.setGeometry(geometry);
 | 
	
		
			
				|  |  | -            features.add(feature);
 | 
	
		
			
				|  |  | -            esriModel.setFeatures(features);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            // 获取系统的根目录
 | 
	
		
			
				|  |  | -            temp = System.getProperty("user.dir")+"\\data";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            vectorFilePath = temp + "\\" + System.currentTimeMillis() + ".json";
 | 
	
		
			
				|  |  | -            //写入文件
 | 
	
		
			
				|  |  | -            FileOutputStream fos = null;
 | 
	
		
			
				|  |  | -            String fileinput = JSON.toJSONString(esriModel);
 | 
	
		
			
				|  |  | -            Boolean writeStatus = true;
 | 
	
		
			
				|  |  | -            try {
 | 
	
		
			
				|  |  | -                fos = new FileOutputStream(vectorFilePath, false);
 | 
	
		
			
				|  |  | -                //true表示在文件末尾追加
 | 
	
		
			
				|  |  | -                fos.write(fileinput.toString().getBytes());
 | 
	
		
			
				|  |  | -                fos.close();
 | 
	
		
			
				|  |  | -            } catch (FileNotFoundException e) {
 | 
	
		
			
				|  |  | -                fos.close();
 | 
	
		
			
				|  |  | -                e.printStackTrace();
 | 
	
		
			
				|  |  | -                writeStatus = false;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (!writeStatus) {
 | 
	
		
			
				|  |  | -                return RequestResult.error("自定义范围数据转换失败", null);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            Map<String, String> params = new HashMap<>();
 | 
	
		
			
				|  |  | -            params.put("json", vectorFilePath);
 | 
	
		
			
				|  |  | -            params.put("table", "KJGH.T_FZSS_FXRW_GIS");
 | 
	
		
			
				|  |  | -            pyResult = PythonExecute.RunGisHelper(esrijsonPyFun, params);
 | 
	
		
			
				|  |  | -            fzxzDTO.setXzfw("");
 | 
	
		
			
				|  |  | -        } else if (fxfwDictDTO.getShp().equals(fwlx)) {//shp文件
 | 
	
		
			
				|  |  | -            vectorFilePath = fzxzDTO.getXzfw();
 | 
	
		
			
				|  |  | -            List<Field> listField = new ArrayList<Field>();
 | 
	
		
			
				|  |  | -            listField.add(new Field().init("RWBSM", fzxzDTO.getBsm()));
 | 
	
		
			
				|  |  | -            listField.add(new Field().init("RWLX", rwlx));
 | 
	
		
			
				|  |  | -            Map<String, Object> params = new HashMap<>();
 | 
	
		
			
				|  |  | -            params.put("shpfile", vectorFilePath);
 | 
	
		
			
				|  |  | -            params.put("table", "KJGH.T_FZSS_FXRW_GIS");
 | 
	
		
			
				|  |  | -            params.put("fields", listField);
 | 
	
		
			
				|  |  | -            pyResult = PythonExecute.RunGisHelper(shpPyFun, params);
 | 
	
		
			
				|  |  | -            fzxzDTO.setXzfw("");
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            return RequestResult.error("分析类型未定义", null);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (pyResult.contains("####OK####")) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        } else if (pyResult.contains("####ERROR####")) {
 | 
	
		
			
				|  |  | -            return RequestResult.error("分析范围数据入库失败", 0);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        System.out.println("辅助选址分析范围要素插入成功!! RWBSM = " + fzxzDTO.getBsm());
 | 
	
		
			
				|  |  | +        // Integer fwlx = fzxzDTO.getFwlx();
 | 
	
		
			
				|  |  | +        // rwlx = StringUtils.isEmpty(rwlx) ? "辅助选址" : rwlx;
 | 
	
		
			
				|  |  | +        // String vectorFilePath = "";
 | 
	
		
			
				|  |  | +        // String pyResult = "";
 | 
	
		
			
				|  |  | +        // if (fxfwDictDTO.getRegion().equals(fwlx)) {
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +        // } else if (fxfwDictDTO.getDraw().equals(fwlx)) {//自定义绘制范围
 | 
	
		
			
				|  |  | +        //     EsriJsonModel esriModel = new EsriJsonModel();
 | 
	
		
			
				|  |  | +        //     //字段汉化
 | 
	
		
			
				|  |  | +        //     Map<String, String> fieldAliases = new HashMap<>();
 | 
	
		
			
				|  |  | +        //     fieldAliases.put("RWBSM", "RWBSM");
 | 
	
		
			
				|  |  | +        //     fieldAliases.put("RWLX", "RWLX");
 | 
	
		
			
				|  |  | +        //     esriModel.setFieldAliases(fieldAliases);
 | 
	
		
			
				|  |  | +        //     //geojson绘制范围转换
 | 
	
		
			
				|  |  | +        //     JSONObject geojson = new JSONObject(JSON.parseObject(fzxzDTO.getXzfw()));
 | 
	
		
			
				|  |  | +        //     Geometry geom = (Geometry) JSONObject.toJavaObject(geojson, Geometry.class);
 | 
	
		
			
				|  |  | +        //     //字段信息
 | 
	
		
			
				|  |  | +        //     List<EsriField> fields = new ArrayList<EsriField>();
 | 
	
		
			
				|  |  | +        //     fields.add(new EsriField().init("RWBSM", "RWBSM"));
 | 
	
		
			
				|  |  | +        //     fields.add(new EsriField().init("RWLX", "RWLX"));
 | 
	
		
			
				|  |  | +        //     esriModel.setFields(fields);
 | 
	
		
			
				|  |  | +        //     //要素
 | 
	
		
			
				|  |  | +        //     List<EsriFeature> features = new ArrayList<>();
 | 
	
		
			
				|  |  | +        //     EsriFeature feature = new EsriFeature();
 | 
	
		
			
				|  |  | +        //     Map<String, Object> attributes = new HashMap<>();
 | 
	
		
			
				|  |  | +        //     attributes.put("RWBSM", fzxzDTO.getBsm());
 | 
	
		
			
				|  |  | +        //     attributes.put("RWLX", rwlx);
 | 
	
		
			
				|  |  | +        //     feature.setAttributes(attributes);
 | 
	
		
			
				|  |  | +        //     EsriGeometry geometry = new EsriGeometry();
 | 
	
		
			
				|  |  | +        //     geometry.setRings(geom.getCoordinates());
 | 
	
		
			
				|  |  | +        //     feature.setGeometry(geometry);
 | 
	
		
			
				|  |  | +        //     features.add(feature);
 | 
	
		
			
				|  |  | +        //     esriModel.setFeatures(features);
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +        //     // 获取系统的根目录
 | 
	
		
			
				|  |  | +        //     temp = System.getProperty("user.dir")+"\\data";
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +        //     vectorFilePath = temp + "\\" + System.currentTimeMillis() + ".json";
 | 
	
		
			
				|  |  | +        //     //写入文件
 | 
	
		
			
				|  |  | +        //     FileOutputStream fos = null;
 | 
	
		
			
				|  |  | +        //     String fileinput = JSON.toJSONString(esriModel);
 | 
	
		
			
				|  |  | +        //     Boolean writeStatus = true;
 | 
	
		
			
				|  |  | +        //     try {
 | 
	
		
			
				|  |  | +        //         fos = new FileOutputStream(vectorFilePath, false);
 | 
	
		
			
				|  |  | +        //         //true表示在文件末尾追加
 | 
	
		
			
				|  |  | +        //         fos.write(fileinput.toString().getBytes());
 | 
	
		
			
				|  |  | +        //         fos.close();
 | 
	
		
			
				|  |  | +        //     } catch (FileNotFoundException e) {
 | 
	
		
			
				|  |  | +        //         fos.close();
 | 
	
		
			
				|  |  | +        //         e.printStackTrace();
 | 
	
		
			
				|  |  | +        //         writeStatus = false;
 | 
	
		
			
				|  |  | +        //     }
 | 
	
		
			
				|  |  | +        //     if (!writeStatus) {
 | 
	
		
			
				|  |  | +        //         return RequestResult.error("自定义范围数据转换失败", null);
 | 
	
		
			
				|  |  | +        //     }
 | 
	
		
			
				|  |  | +        //     Map<String, String> params = new HashMap<>();
 | 
	
		
			
				|  |  | +        //     params.put("json", vectorFilePath);
 | 
	
		
			
				|  |  | +        //     params.put("table", "KJGH.T_FZSS_FXRW_GIS");
 | 
	
		
			
				|  |  | +        //     pyResult = PythonExecute.RunGisHelper(esrijsonPyFun, params);
 | 
	
		
			
				|  |  | +        //     fzxzDTO.setXzfw("");
 | 
	
		
			
				|  |  | +        // } else if (fxfwDictDTO.getShp().equals(fwlx)) {//shp文件
 | 
	
		
			
				|  |  | +        //     vectorFilePath = fzxzDTO.getXzfw();
 | 
	
		
			
				|  |  | +        //     List<Field> listField = new ArrayList<Field>();
 | 
	
		
			
				|  |  | +        //     listField.add(new Field().init("RWBSM", fzxzDTO.getBsm()));
 | 
	
		
			
				|  |  | +        //     listField.add(new Field().init("RWLX", rwlx));
 | 
	
		
			
				|  |  | +        //     Map<String, Object> params = new HashMap<>();
 | 
	
		
			
				|  |  | +        //     params.put("shpfile", vectorFilePath);
 | 
	
		
			
				|  |  | +        //     params.put("table", "KJGH.T_FZSS_FXRW_GIS");
 | 
	
		
			
				|  |  | +        //     params.put("fields", listField);
 | 
	
		
			
				|  |  | +        //     pyResult = PythonExecute.RunGisHelper(shpPyFun, params);
 | 
	
		
			
				|  |  | +        //     fzxzDTO.setXzfw("");
 | 
	
		
			
				|  |  | +        // } else {
 | 
	
		
			
				|  |  | +        //     return RequestResult.error("分析类型未定义", null);
 | 
	
		
			
				|  |  | +        // }
 | 
	
		
			
				|  |  | +        // if (pyResult.contains("####OK####")) {
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +        // } else if (pyResult.contains("####ERROR####")) {
 | 
	
		
			
				|  |  | +        //     return RequestResult.error("分析范围数据入库失败", 0);
 | 
	
		
			
				|  |  | +        // }
 | 
	
		
			
				|  |  | +        // System.out.println("辅助选址分析范围要素插入成功!! RWBSM = " + fzxzDTO.getBsm());
 | 
	
		
			
				|  |  |          return null;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |