Browse Source

调整样式代码

liwh 1 year ago
parent
commit
e10e82781b

+ 0 - 98
cql-service/src/main/java/cn/com/taiji/cql/model/MergeDynamicShip.java

@@ -1,98 +0,0 @@
-package cn.com.taiji.cql.model;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.io.Serializable;
-
-/**
- * 船舶动态融合数据
- * @author lxg
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class MergeDynamicShip implements Serializable {
-    private static final long serialVersionUID = -7661996382540318133L;
-
-    /**
-     * 融合数据ID
-     */
-    private String mergeId;
-
-    /**
-     * 融合时间
-     */
-    private String mergeTime;
-
-    /**
-     * 船舶唯一标识
-     */
-    private String mergeTarget;
-
-    /**
-     * 地理空间数据
-     */
-    private String location;
-
-    /**
-     * 加冰加水状态
-     */
-    private Integer supplyIceWaterState;
-
-    /**
-     * 加油状态
-     */
-    private Integer refueledState;
-
-    /**
-     * 在航状态
-     */
-    private Integer motionState;
-
-    /**
-     * 目标(航迹)可信度
-     */
-    private Integer targetTypeReliability;
-
-    /**
-     * 港口状态
-     */
-    private Integer portState;
-
-    /**
-     * 目标分类
-     */
-    private Integer targetType;
-
-
-    /**
-     * 目标长度
-     */
-    private Double targetLength;
-
-    /**
-     * 目标航速
-     */
-    private Double targetSpeed;
-
-
-    /**
-     * (GIS)地图筛选专用字段
-     */
-    private Integer gisNationality;
-
-    /**
-     * (GIS)地图筛选专用字段
-     */
-    private Integer gisShipType;
-
-    @Override
-    public String toString() {
-        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
-    }
-}

+ 0 - 10
cql-service/src/main/java/cn/com/taiji/cql/service/IECqlService.java

@@ -12,16 +12,6 @@ public interface IECqlService {
 
     /**
      * cql 通用查询接口
-     * @param mapParams
-     * @param cql
-     * @return
-     */
-    PageResult cqlQuery4Mysql(Map<String, Object> mapParams, String cql, Map<String,Object> sortMaps, Map<String, Object> pageParams);
-
-
-
-    /**
-     * cql 通用查询接口
      * @param dsParams
      * @param paramMaps
      * @return

+ 7 - 207
cql-service/src/main/java/cn/com/taiji/cql/service/impl/ECqlServiceImpl.java

@@ -40,22 +40,22 @@ public class ECqlServiceImpl implements IECqlService{
 
     /**
      * cql 通用查询接口
-     * @param mapParams
-     * @param cql
+     * @param dsParams
+     * @param paramMaps
      * @return
      */
     @Override
-    public PageResult cqlQuery4Mysql(Map<String, Object> mapParams, String cql, Map<String,Object> sortMaps, Map<String, Object> pageParams) {
+    public PageResult cqlQuery(Map<String, Object> dsParams,Map<String,Object> paramMaps) {
 
         List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
 
         DataStore dataStore = null;
 
-        String host = mapParams.get(JDBCDataStoreFactory.HOST.key).toString();
+        String host = dsParams.get(JDBCDataStoreFactory.HOST.key).toString();
 
-        String port = mapParams.get(JDBCDataStoreFactory.PORT.key).toString();
+        String port = dsParams.get(JDBCDataStoreFactory.PORT.key).toString();
 
-        String database = mapParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
+        String database = dsParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
 
         int hashKey = HashCodeUtil.hashCode(host+"-"+port+"-"+database);
 
@@ -73,7 +73,6 @@ public class ECqlServiceImpl implements IECqlService{
 
 
         try {
-
             if(dataStoreMaps.containsKey(String.valueOf(hashKey))){
 
                 dataStore = dataStoreMaps.get(String.valueOf(hashKey));
@@ -82,7 +81,7 @@ public class ECqlServiceImpl implements IECqlService{
 
             }else{
 
-                dataStore = DataStoreFinder.getDataStore(mapParams);
+                dataStore = DataStoreFinder.getDataStore(dsParams);
 
                 dataStoreMaps.put(String.valueOf(hashKey),dataStore);
 
@@ -92,198 +91,6 @@ public class ECqlServiceImpl implements IECqlService{
 
             if (dataStore != null) {
 
-                //根据表名获取source
-                SimpleFeatureSource fSource=dataStore.getFeatureSource(mapParams.get("tableName").toString());
-
-
-                FilterFactoryImpl filterFactory = new FilterFactoryImpl();
-
-
-
-                Query query = new Query();
-
-                if(cql !=null && !"".equals(cql)){
-
-                    Filter filter = ECQL.toFilter(cql);
-
-                    query.setFilter(filter);
-
-                }
-
-
-
-
-                if(sortMaps !=null && !"".equals(sortMaps) && sortMaps.keySet().size() >0){
-
-                    List<SortByImpl> sortByList = new ArrayList<SortByImpl>();
-
-                    for (String sortKey : sortMaps.keySet()) {
-
-                        String sortValue = sortMaps.get(sortKey).toString();
-
-                        if("asc".equals(sortValue.toLowerCase())){
-
-                            SortByImpl sb = new SortByImpl(filterFactory.property(sortKey),SortOrder.ASCENDING);
-
-                            sortByList.add(sb);
-                        }else{
-
-                            SortByImpl sb = new SortByImpl(filterFactory.property(sortKey),SortOrder.DESCENDING);
-
-                            sortByList.add(sb);
-
-                        }
-
-
-                    }
-
-                    query.setSortBy(sortByList.toArray(new SortBy[sortByList.size()]));
-
-                }
-
-
-
-                //查询记录总数
-                count = Long.valueOf(fSource.getCount(query));
-
-                if(pageParams !=null && !"".equals(pageParams) && pageParams.keySet().size() >0){
-
-                    if(pageParams.containsKey("pageNumber")){
-
-                        pageNumber = Long.valueOf(pageParams.get("pageNumber").toString());
-
-                    }
-
-                    if(pageParams.containsKey("pageSize")){
-
-                        pageSize = Long.valueOf(pageParams.get("pageSize").toString());
-                    }
-
-                    int startIndex = pageNumber.intValue()-1 <=0?0:pageNumber.intValue()-1;
-
-                    //设置分页查询参数
-                    query.setStartIndex(startIndex*pageSize.intValue());
-
-                    query.setMaxFeatures(pageSize.intValue());
-
-                    //计算总页数
-                    if (count%pageSize ==0){
-
-                        pageCount = count/pageSize;
-
-                    }else{
-
-                        pageCount = count/pageSize +1;
-                    }
-                }
-
-
-
-                SimpleFeatureCollection simpleFeatureCollection =fSource.getFeatures(query);
-
-                if(simpleFeatureCollection !=null){
-
-                    // 获取当前矢量数据有哪些属性字段值
-                    List<AttributeDescriptor> attributeList = simpleFeatureCollection.getSchema().getAttributeDescriptors();
-
-
-                    SimpleFeatureIterator simpleFeatureIterator = simpleFeatureCollection.features();
-
-                    while (simpleFeatureIterator.hasNext()){
-                        //获取每一个要素
-                        SimpleFeature simpleFeature = simpleFeatureIterator.next();
-
-                        Map<String, Object> dataMap = new HashMap<String, Object>();
-
-                        String id = simpleFeature.getID();
-                        id = id.substring(id.lastIndexOf(".")+1);
-
-                        dataMap.put("id",id);
-                        dataMap.put("dataId","qy_"+id);
-
-                        for(AttributeDescriptor attribute:attributeList){
-
-//                            System.out.println(attribute.getLocalName() + ":" + simpleFeature.getAttribute(attribute.getLocalName()));
-
-                            dataMap.put(attribute.getLocalName(),simpleFeature.getAttribute(attribute.getLocalName()));
-
-                        }
-
-                        dataList.add(dataMap);
-
-
-                    }
-
-                    simpleFeatureIterator.close();
-
-
-                }
-
-            } else {
-
-                log.info("系统连接到位于:" + host + "的空间数据库" + database + "失败!请检查相关参数");
-
-            }
-
-        }catch (Exception e) {
-
-            e.printStackTrace();
-            log.error("系统连接到位于:" + mapParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + mapParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
-
-        }
-
-        int respCode = 0;
-
-        String respMsg = "操作成功";
-
-        if(count == 0){
-
-            respCode = 1;
-            respMsg = "操作成功,但没有查找到记录!";
-
-        }
-
-        return PageResult.<List<Map<String, Object>>>builder().datas(dataList).resp_code(respCode).resp_msg(respMsg).pageSize(pageSize).pageNumber(pageNumber).pageCount(pageCount).recordCount(count).build();
-
-
-    }
-
-    /**
-     * cql 通用查询接口
-     * @param dsParams
-     * @param paramMaps
-     * @return
-     */
-    @Override
-    public PageResult cqlQuery(Map<String, Object> dsParams,Map<String,Object> paramMaps) {
-
-        List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
-
-        DataStore dataStore = null;
-
-        String host = dsParams.get(JDBCDataStoreFactory.HOST.key).toString();
-
-        String database = dsParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
-
-        //查询记录总数
-        Long count =0l;
-
-        //当前页数
-        Long pageNumber= CommonConstant.PAGE_NUMBER;
-
-        //一页显示多少条记录
-        Long pageSize=CommonConstant.PAGE_SIZE;
-
-        //总页数
-        Long pageCount =0l;
-
-
-        try {
-
-            dataStore = DataStoreFinder.getDataStore(dsParams);
-
-            if (dataStore != null) {
-
                 log.info("系统连接到位于:" + host + "的空间数据库" + database + "成功!");
 
                 //根据表名获取source
@@ -426,13 +233,6 @@ public class ECqlServiceImpl implements IECqlService{
             e.printStackTrace();
             log.error("系统连接到位于:" + dsParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + dsParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
 
-        }finally {
-
-            if(dataStore !=null){
-
-                dataStore.dispose();
-
-            }
         }
 
         int respCode = 0;

+ 0 - 2
cql-service/src/main/java/cn/com/taiji/cql/test/EcqlTest.java

@@ -1,6 +1,5 @@
 package cn.com.taiji.cql.test;
 
-import cn.com.taiji.cql.model.GeoDataSource;
 import com.alibaba.fastjson.JSONObject;
 import org.geotools.api.data.*;
 import org.geotools.api.feature.simple.SimpleFeature;
@@ -122,7 +121,6 @@ public class EcqlTest {
 
         if (dataList.size() >0){
 
-            GeoDataSource gds = JSONObject.parseObject(JSONObject.toJSONString(dataList.get(0)), GeoDataSource.class);
 
         }
     }

+ 210 - 0
cql-service/src/main/java/cn/com/taiji/cql/test/EcqlTest3.java

@@ -0,0 +1,210 @@
+package cn.com.taiji.cql.test;
+
+import cn.com.taiji.common.model.TileDataSource;
+import com.alibaba.fastjson.JSONObject;
+import org.geotools.api.data.DataStore;
+import org.geotools.api.data.DataStoreFinder;
+import org.geotools.api.data.Query;
+import org.geotools.api.data.SimpleFeatureSource;
+import org.geotools.api.feature.simple.SimpleFeature;
+import org.geotools.api.feature.simple.SimpleFeatureType;
+import org.geotools.api.feature.type.AttributeDescriptor;
+import org.geotools.api.filter.Filter;
+import org.geotools.data.jdbc.datasource.DBCPDataSourceFactory;
+import org.geotools.data.jdbc.datasource.DataSourceFinder;
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.filter.text.ecql.ECQL;
+import org.geotools.jdbc.JDBCDataStoreFactory;
+
+import javax.sql.DataSource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EcqlTest3 {
+
+    public static void main(String[] args) throws Exception{
+
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+
+        mapParams.put(JDBCDataStoreFactory.DATABASE.key, "geo");
+        mapParams.put(JDBCDataStoreFactory.DBTYPE.key, "mysql");
+
+        mapParams.put(JDBCDataStoreFactory.HOST.key, "8.140.240.182");
+        mapParams.put(JDBCDataStoreFactory.PORT.key, "18080");
+        mapParams.put(JDBCDataStoreFactory.USER.key, "root");
+        mapParams.put(JDBCDataStoreFactory.PASSWD.key, "Taiji@2023#data");
+
+        queryBBox(mapParams);
+
+
+
+
+
+    }
+
+
+    public static void queryBBox(Map<String, Object> mapParams){
+
+        DataStore dataStore = null;
+
+        String host = mapParams.get(JDBCDataStoreFactory.HOST.key).toString();
+
+        String database = mapParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
+
+        List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
+
+
+        try {
+
+            dataStore = DataStoreFinder.getDataStore(mapParams);
+
+            if (dataStore != null) {
+
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "成功!");
+
+                //根据表名获取source
+                SimpleFeatureSource fSource=dataStore.getFeatureSource("tile_data_source");
+
+                String strData = "layer_code='geo_fk_ship'";
+
+                Filter filter = ECQL.toFilter(strData);
+
+                SimpleFeatureCollection fCollection =fSource.getFeatures(filter);
+
+                if(fCollection !=null){
+
+
+
+                    SimpleFeatureIterator itertor = fCollection.features();
+
+                    while (itertor.hasNext()){
+                        //获取每一个要素
+                        SimpleFeature feature = itertor.next();
+
+                        Map<String, Object> dataMap = new HashMap<String, Object>();
+
+                        SimpleFeatureType simpleFeatureType = feature.getFeatureType();
+
+                        List<AttributeDescriptor> attributeList = simpleFeatureType.getAttributeDescriptors();
+                        for(AttributeDescriptor ad:attributeList){
+
+                            String key_ = ad.getName().toString();
+                            Object value_ = feature.getAttribute(key_);
+
+                            System.out.println(key_+":"+value_);
+
+                            dataMap.put(key_,value_);
+
+                        }
+
+                        dataList.add(dataMap);
+                    }
+
+
+                }
+
+            } else {
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "失败!请检查相关参数");
+
+            }
+
+        }catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("系统连接到位于:" + mapParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + mapParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
+        }
+
+
+        if (dataList.size() >0){
+
+            TileDataSource gds = JSONObject.parseObject(JSONObject.toJSONString(dataList.get(0)), TileDataSource.class);
+
+        }
+    }
+
+    public static void query1(Map<String, Object> mapParams){
+
+        DataStore dataStore = null;
+
+        String host = mapParams.get(JDBCDataStoreFactory.HOST.key).toString();
+
+        String database = mapParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
+
+
+        try {
+
+            dataStore = DataStoreFinder.getDataStore(mapParams);
+
+            if (dataStore != null) {
+
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "成功!");
+
+                //根据表名获取source
+                SimpleFeatureSource fSource=dataStore.getFeatureSource("geo_test");
+
+                String strData = "name=1";
+
+                Filter filter = ECQL.toFilter(strData);
+
+                SimpleFeatureCollection fCollection =fSource.getFeatures(filter);
+
+                if(fCollection !=null){
+
+
+
+                    SimpleFeatureIterator itertor = fCollection.features();
+
+                    while (itertor.hasNext()){
+                        //获取每一个要素
+                        SimpleFeature feature = itertor.next();
+
+                        System.out.println(feature.getAttribute(1));
+                        System.out.println(feature.getAttribute("name").toString());
+                    }
+
+
+                }
+
+            } else {
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "失败!请检查相关参数");
+
+            }
+
+        }catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("系统连接到位于:" + mapParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + mapParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
+        }
+    }
+
+
+    private void test1() throws Exception{
+
+        //先定义cql查询语句
+        String bbox = "bbox (geom, 115.31412 ,10.89577, 125.31412, 80.89577)";
+
+        //声明Query查询对象
+        Query query = new Query("string-data", ECQL.toFilter(bbox));
+
+        Filter filter = ECQL.toFilter(bbox);
+
+        //构建mysql数据库连接数据源--DataSource
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+        mapParams.put(DBCPDataSourceFactory.DSTYPE.key, "DBCP");
+        mapParams.put(DBCPDataSourceFactory.DRIVERCLASS.key, "com.mysql.cj.jdbc.Driver");
+        mapParams.put(DBCPDataSourceFactory.JDBC_URL.key, "jdbc:mysql://172.16.67.23:7306/geo?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai");
+        mapParams.put(DBCPDataSourceFactory.USERNAME.key, "root");
+        mapParams.put(DBCPDataSourceFactory.PASSWORD.key, "Ucsp123#");
+        mapParams.put(DBCPDataSourceFactory.MAXACTIVE.key, Integer.valueOf(10));
+        mapParams.put(DBCPDataSourceFactory.MAXIDLE.key, Integer.valueOf(0));
+
+        DataSource source = DataSourceFinder.getDataSource(mapParams);
+
+        DataStore dataStore = DataStoreFinder.getDataStore(mapParams);
+
+
+        System.out.println("111111111111");
+
+    }
+}

+ 219 - 0
cql-service/src/main/java/cn/com/taiji/cql/test/EcqlTest4.java

@@ -0,0 +1,219 @@
+package cn.com.taiji.cql.test;
+
+import com.alibaba.fastjson.JSONObject;
+import org.geotools.api.data.DataStore;
+import org.geotools.api.data.DataStoreFinder;
+import org.geotools.api.data.Query;
+import org.geotools.api.data.SimpleFeatureSource;
+import org.geotools.api.feature.simple.SimpleFeature;
+import org.geotools.api.feature.simple.SimpleFeatureType;
+import org.geotools.api.feature.type.AttributeDescriptor;
+import org.geotools.api.filter.Filter;
+import org.geotools.api.filter.FilterFactory;
+import org.geotools.data.jdbc.datasource.DBCPDataSourceFactory;
+import org.geotools.data.jdbc.datasource.DataSourceFinder;
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.filter.text.ecql.ECQL;
+import org.geotools.geometry.jts.JTS;
+import org.geotools.jdbc.JDBCDataStoreFactory;
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.locationtech.jts.geom.Point;
+
+import javax.sql.DataSource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EcqlTest4 {
+
+    public static void main(String[] args) throws Exception{
+
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+
+        mapParams.put(JDBCDataStoreFactory.DATABASE.key, "geo");
+        mapParams.put(JDBCDataStoreFactory.DBTYPE.key, "mysql");
+
+        mapParams.put(JDBCDataStoreFactory.HOST.key, "172.16.67.23");
+        mapParams.put(JDBCDataStoreFactory.PORT.key, "7306");
+        mapParams.put(JDBCDataStoreFactory.USER.key, "root");
+        mapParams.put(JDBCDataStoreFactory.PASSWD.key, "Ucsp123#");
+
+        queryDistance(mapParams,110.004351,18.518221,2d);
+
+
+
+
+
+    }
+
+
+    public static void queryDistance(Map<String, Object> mapParams,double longitude,double latitude,double radius){
+
+        DataStore dataStore = null;
+
+        String host = mapParams.get(JDBCDataStoreFactory.HOST.key).toString();
+
+        String database = mapParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
+
+        List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
+
+
+        try {
+
+            dataStore = DataStoreFinder.getDataStore(mapParams);
+
+            if (dataStore != null) {
+
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "成功!");
+
+                double pointDistance = radius * Math.sqrt(2);
+
+
+                Point point = new GeometryFactory().createPoint(new Coordinate(longitude, latitude));
+
+                // threshold distance
+                double distance = pointDistance;
+
+                FilterFactory ff = CommonFactoryFinder.getFilterFactory();
+                Filter filter =
+                        ff.dwithin(ff.property("location"), ff.literal(point), radius/6378.137, "km");
+
+                //根据表名获取source
+                SimpleFeatureSource fSource=dataStore.getFeatureSource("stg_view_deviceinfo_df");
+
+                SimpleFeatureCollection fCollection =fSource.getFeatures(filter);
+
+                System.out.println("1111111111111111111:"+fCollection.size());
+
+                if(fCollection !=null){
+
+
+
+                    SimpleFeatureIterator itertor = fCollection.features();
+
+                    while (itertor.hasNext()){
+                        //获取每一个要素
+                        SimpleFeature feature = itertor.next();
+
+                        Map<String, Object> dataMap = new HashMap<String, Object>();
+
+                        SimpleFeatureType simpleFeatureType = feature.getFeatureType();
+
+                        List<AttributeDescriptor> attributeList = simpleFeatureType.getAttributeDescriptors();
+                        for(AttributeDescriptor ad:attributeList){
+
+                            String key_ = ad.getName().toString();
+                            Object value_ = feature.getAttribute(key_);
+
+                            System.out.println(key_+":"+value_);
+
+                            //dataMap.put(key_,value_);
+
+                        }
+
+                        //dataList.add(dataMap);
+                    }
+
+
+                }
+
+
+            } else {
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "失败!请检查相关参数");
+
+            }
+
+        }catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("系统连接到位于:" + mapParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + mapParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
+        }
+    }
+
+    public static void query1(Map<String, Object> mapParams){
+
+        DataStore dataStore = null;
+
+        String host = mapParams.get(JDBCDataStoreFactory.HOST.key).toString();
+
+        String database = mapParams.get(JDBCDataStoreFactory.DATABASE.key).toString();
+
+
+        try {
+
+            dataStore = DataStoreFinder.getDataStore(mapParams);
+
+            if (dataStore != null) {
+
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "成功!");
+
+                //根据表名获取source
+                SimpleFeatureSource fSource=dataStore.getFeatureSource("geo_test");
+
+                String strData = "name=1";
+
+                Filter filter = ECQL.toFilter(strData);
+
+                SimpleFeatureCollection fCollection =fSource.getFeatures(filter);
+
+                if(fCollection !=null){
+
+
+
+                    SimpleFeatureIterator itertor = fCollection.features();
+
+                    while (itertor.hasNext()){
+                        //获取每一个要素
+                        SimpleFeature feature = itertor.next();
+
+                        System.out.println(feature.getAttribute(1));
+                        System.out.println(feature.getAttribute("name").toString());
+                    }
+
+
+                }
+
+            } else {
+                System.out.println("系统连接到位于:" + host + "的空间数据库" + database + "失败!请检查相关参数");
+
+            }
+
+        }catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("系统连接到位于:" + mapParams.get(JDBCDataStoreFactory.HOST.key) + "的空间数据库" + mapParams.get(JDBCDataStoreFactory.DATABASE.key) + "失败!请检查相关参数");
+        }
+    }
+
+
+    private void test1() throws Exception{
+
+        //先定义cql查询语句
+        String bbox = "bbox (geom, 115.31412 ,10.89577, 125.31412, 80.89577)";
+
+        //声明Query查询对象
+        Query query = new Query("string-data", ECQL.toFilter(bbox));
+
+        Filter filter = ECQL.toFilter(bbox);
+
+        //构建mysql数据库连接数据源--DataSource
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+        mapParams.put(DBCPDataSourceFactory.DSTYPE.key, "DBCP");
+        mapParams.put(DBCPDataSourceFactory.DRIVERCLASS.key, "com.mysql.cj.jdbc.Driver");
+        mapParams.put(DBCPDataSourceFactory.JDBC_URL.key, "jdbc:mysql://172.16.67.23:7306/geo?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai");
+        mapParams.put(DBCPDataSourceFactory.USERNAME.key, "root");
+        mapParams.put(DBCPDataSourceFactory.PASSWORD.key, "Ucsp123#");
+        mapParams.put(DBCPDataSourceFactory.MAXACTIVE.key, Integer.valueOf(10));
+        mapParams.put(DBCPDataSourceFactory.MAXIDLE.key, Integer.valueOf(0));
+
+        DataSource source = DataSourceFinder.getDataSource(mapParams);
+
+        DataStore dataStore = DataStoreFinder.getDataStore(mapParams);
+
+
+        System.out.println("111111111111");
+
+    }
+}

+ 22 - 0
cql-service/src/main/java/cn/com/taiji/cql/test/TestDistance.java

@@ -0,0 +1,22 @@
+package cn.com.taiji.cql.test;
+
+import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
+import org.geotools.geometry.jts.JTS;
+import org.geotools.referencing.crs.DefaultGeographicCRS;
+import org.locationtech.jts.geom.Coordinate;
+
+public class TestDistance {
+
+    public static void main(String[] args) throws Exception{
+
+        CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
+
+        Coordinate c1 = new Coordinate(110.3893805, 18.98851917);
+        Coordinate c2 = new Coordinate(110.371739, 18.973134);
+
+        double dist = JTS.orthodromicDistance(c1, c2, crs);
+
+        System.out.println(dist);
+
+    }
+}

+ 80 - 0
cql-service/src/main/java/cn/com/taiji/cql/test/TestEs.java

@@ -0,0 +1,80 @@
+package cn.com.taiji.cql.test;
+
+import cn.com.taiji.common.model.EsDataSource;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.elasticsearch.client.RestClient;
+import org.geotools.api.data.DataStore;
+import org.geotools.data.elasticsearch.ElasticDataStore;
+import org.geotools.data.elasticsearch.ElasticDataStoreFactory;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestEs {
+
+    public static void main(String[] args) throws Exception{
+
+
+        EsDataSource esDataSource = new EsDataSource();
+        esDataSource.setUris("172.16.67.39:9211,172.16.67.40:9211,172.16.67.41:9211");
+        esDataSource.setUsername("elastic");
+        esDataSource.setPassword("Ucsp*20220922*");
+        esDataSource.setConnectionTimeout(5000);
+        esDataSource.setMaxConnection(100);
+        esDataSource.setConnectionRequestTimeout(30000);
+        esDataSource.setSocketTimeout(30000);
+        esDataSource.setMaxIdle(2);
+        esDataSource.setMaxTotal(3);
+        esDataSource.setMinIdle(1);
+
+        RestClient restClient = createRestClient(esDataSource);
+
+        DataStore dataStore = new ElasticDataStore(restClient, "hnwt_common_use_es");
+        String[] typeNames = dataStore.getTypeNames();
+
+        System.out.println(typeNames.length);
+
+
+
+    }
+
+    public static RestClient createRestClient(EsDataSource esDataSource) throws Exception {
+
+        String[] esUris=esDataSource.getUris().split(",");
+
+        HttpHost[] httpHosts = new HttpHost[esUris.length];
+        //将地址转换为http主机数组,未配置端口则采用默认9200端口,配置了端口则用配置的端口
+        for (int i = 0; i < httpHosts.length; i++) {
+            if (!StringUtils.isEmpty(esUris[i])) {
+                if (esUris[i].contains(":")) {
+                    String[] uris = esUris[i].split(":");
+                    httpHosts[i] = new HttpHost(uris[0], Integer.parseInt(uris[1]), "http");
+                } else {
+                    httpHosts[i] = new HttpHost(esUris[i], 9200, "http");
+                }
+            }
+        }
+
+        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+        credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(esDataSource.getUsername(), esDataSource.getPassword()));
+
+        return RestClient.builder(httpHosts)
+                .setRequestConfigCallback(
+                        requestConfigBuilder -> {
+                            requestConfigBuilder.setConnectTimeout(esDataSource.getConnectionTimeout());
+                            requestConfigBuilder.setSocketTimeout(esDataSource.getSocketTimeout());
+                            requestConfigBuilder.setConnectionRequestTimeout(esDataSource.getConnectionRequestTimeout());
+                            return requestConfigBuilder;
+                        }
+                ).setHttpClientConfigCallback(
+                        httpAsyncClientBuilder -> httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider).setMaxConnTotal(30).setMaxConnPerRoute(30)
+                ).build();
+
+    }
+}

+ 85 - 0
tile-common/src/main/java/cn/com/taiji/common/model/LayerGroupDsView.java

@@ -0,0 +1,85 @@
+package cn.com.taiji.common.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class LayerGroupDsView implements Serializable {
+
+    /**
+     * 图层代码
+     */
+    private String layerCode;
+
+    /**
+     * 图层名称
+     */
+    private String layerName;
+
+    /**
+     * 图层数据源id
+     */
+    private String layerDsId;
+
+    /**
+     * 图层执行数据
+     */
+    private String layerDataRun;
+
+
+    /**
+     * 图层执行类型:sql代表执行sql语句,cql代表执行cql查询语句
+     */
+    private String layerDataType;
+
+    /**
+     * 图层组代码
+     */
+    private String groupCode;
+
+    /**
+     * 图层组名称
+     */
+    private String groupName;
+
+    /**
+     * 排序
+     */
+    private String sort;
+
+    /**
+     * 图层数据源数据库
+     */
+    private String dataBase;
+
+    /**
+     * 图层数据源数据库类型
+     */
+    private String dbType;
+
+    /**
+     * 图层数据源数据库ip地址和端口
+     */
+    private String host;
+
+    /**
+     * 图层数据源数据库用户名称
+     */
+    private String userName;
+
+    /**
+     * 图层数据源数据库用户密码
+     */
+    private String userPassword;
+
+    /**
+     * bbox查询字段
+     */
+    private String boxColumn;
+
+    /**
+     * 数据表名
+     */
+    private String tableName;
+}

+ 139 - 0
tile-common/src/main/java/cn/com/taiji/common/model/LayerStyleView.java

@@ -0,0 +1,139 @@
+package cn.com.taiji.common.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author zzyx 2024/1/5
+ */
+@Data
+public class LayerStyleView implements Serializable {
+
+
+    /**
+     * 图层代码
+     */
+    private String layerCode;
+
+    /**
+     * 样式id
+     *
+     */
+    private String styleId;
+    /**
+     * 1:点,2:线,3:面
+     *
+     */
+
+    private Integer type;
+
+    /**
+     * 宽度
+     *
+     */
+    private Integer width =1;
+
+    /**
+     * 高度
+     *
+     */
+    private Integer height =1;
+
+    /**
+     * 点线面颜色 颜色支持rgb rgba 如(255,0,255) ||(255, 0, 0, 128)
+     *
+     */
+    private String color;
+
+    /**
+     *
+     * 是否填充或者只显示边框
+     */
+
+    private Integer isFill;
+
+    /**
+     *
+     * 边框颜色
+     */
+    private String borderColor;
+
+    /**
+     *
+     * 边框大小
+     */
+    private Integer borderSize=1;
+
+    /**
+     * 边框为虚线还是实现
+     */
+    private Integer isDashed;
+
+    /**
+     * 虚线间隔 5像素实线,5像素空白  float[] dashPattern = {100, 10};
+     *
+     */
+    private String dashPattern;
+    /**
+     *
+     * 背景图片样式 面背景图片(使用images中的图片)
+     */
+
+    private String bgImage;
+
+    /**
+     * 是否显示中心点名称
+     *
+     */
+
+    private Integer isShowName;
+
+    /**
+     *
+     * 字体颜色
+     */
+    private String fontColor;
+
+    /**
+     * 字体大小
+     */
+    private Integer fontSize=1;
+
+    /**
+     * 中心点图片
+     */
+    private String centerPointImg;
+
+    /**
+     * 点大小
+     */
+
+    private Integer pointSize;
+
+    /**
+     * 点形状(1:正方形,2:三角形,3:圆形)
+     */
+
+    private Integer pointType;
+
+    /**
+     * 面中心点图片
+     */
+    private String centerPointImage;
+
+    /**
+     * 点标记图片
+     */
+    private String pointMarkerImage;
+    /**
+     * 点图片宽度
+     */
+    private Integer pointMarkerImageWidth=13;
+
+    /**
+     * 点图片高度
+     */
+    private Integer pointMarkerImageHeight=13;
+}
+

+ 2 - 27
cql-service/src/main/java/cn/com/taiji/cql/model/GeoDataSource.java

@@ -1,4 +1,4 @@
-package cn.com.taiji.cql.model;
+package cn.com.taiji.common.model;
 
 import lombok.Data;
 
@@ -6,7 +6,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 @Data
-public class GeoDataSource implements Serializable {
+public class TileDataSource implements Serializable {
 
     /**
      * 主键
@@ -14,16 +14,6 @@ public class GeoDataSource implements Serializable {
     private int id;
 
     /**
-     * 图层代码
-     */
-    private String layerCode;
-
-    /**
-     * 图层名称
-     */
-    private String layerName;
-
-    /**
      * 数据库地址
      */
     private String host;
@@ -33,27 +23,12 @@ public class GeoDataSource implements Serializable {
      */
     private String dbType;
 
-    /**
-     * bbox字段
-     */
-    private String bboxColumn;
-
-    /**
-     * 端口号
-     */
-    private int port;
-
 
     /**
      * 数据库名
      */
     private String dataBase;
 
-    /**
-     * 表名
-     */
-    private String tableName;
-
 
     /**
      * 用户名

+ 3 - 2
tile-service/src/main/java/cn/com/taiji/tile/service/ITileService.java

@@ -1,7 +1,8 @@
 package cn.com.taiji.tile.service;
 
 
-import cn.com.taiji.cql.model.GeoDataSource;
+import cn.com.taiji.common.model.LayerGroupDsView;
+import cn.com.taiji.common.model.LayerStyleView;
 import cn.com.taiji.cql.model.GeoRequestParam;
 
 import java.util.List;
@@ -9,7 +10,7 @@ import java.util.List;
 public interface ITileService {
 
 
-    byte[] tileData(GeoRequestParam requestParam, GeoDataSource geoDs);
+    byte[] tileData(GeoRequestParam requestParam, LayerGroupDsView layerGroupDsView,List<LayerStyleView> layerStyleViewList);
 
     /**
      * 查询要素信息

+ 42 - 14
tile-service/src/main/java/cn/com/taiji/tile/service/impl/TileServiceImpl.java

@@ -1,7 +1,8 @@
 package cn.com.taiji.tile.service.impl;
 
 import cn.com.taiji.common.domain.PageResult;
-import cn.com.taiji.cql.model.GeoDataSource;
+import cn.com.taiji.common.model.LayerGroupDsView;
+import cn.com.taiji.common.model.LayerStyleView;
 import cn.com.taiji.cql.model.GeoRequestParam;
 import cn.com.taiji.cql.service.IECqlService;
 import cn.com.taiji.tile.model.POI;
@@ -28,11 +29,10 @@ public class TileServiceImpl implements ITileService {
 
 
     @Override
-    public byte[] tileData(GeoRequestParam requestParam, GeoDataSource geoDs) {
+    public byte[] tileData(GeoRequestParam requestParam, LayerGroupDsView layerGroupDsView,List<LayerStyleView> layerStyleViewList) {
 
         //2根据cql规则获取图层对应的空间地理数据
 
-
         long currentTimeMillis = System.currentTimeMillis();
 
         StringBuffer filterCqlStr = new StringBuffer();
@@ -50,7 +50,7 @@ public class TileServiceImpl implements ITileService {
 
             StringBuffer sbBbox = new StringBuffer();
             sbBbox.append("(bbox (");
-            sbBbox.append(geoDs.getBboxColumn()+",");
+            sbBbox.append(layerGroupDsView.getBoxColumn()+",");
             sbBbox.append(requestParam.getBbox()+"))");
 
             if(filterCqlStr.length() >0){
@@ -64,22 +64,50 @@ public class TileServiceImpl implements ITileService {
 
         }
 
+        String layerDataType = layerGroupDsView.getLayerDataType();
+        String layerDataRun = layerGroupDsView.getLayerDataRun();
+
+        if(layerDataType !=null && !"".equals(layerDataType) && "cql".equals(layerDataType)){
+
+            if(layerDataRun !=null && !"".equals(layerDataRun)){
+
+                if(filterCqlStr.length() >0){
+
+                    filterCqlStr.append(" and "+layerDataRun);
+                }else{
+
+                    filterCqlStr.append(layerDataRun);
+
+                }
+
+            }
+
+        }
+
         System.out.println("查询条件:" + filterCqlStr.toString());
 
+        String host = layerGroupDsView.getHost().split(",")[0].split(":")[0];
+        String port = layerGroupDsView.getHost().split(",")[0].split(":")[1];
+
         Map<String, Object> cqlDsParams = new HashMap<String, Object>();
-        cqlDsParams.put(JDBCDataStoreFactory.DATABASE.key, geoDs.getDataBase());
-        cqlDsParams.put(JDBCDataStoreFactory.DBTYPE.key, geoDs.getDbType());
+        cqlDsParams.put(JDBCDataStoreFactory.DATABASE.key, layerGroupDsView.getDataBase());
+        cqlDsParams.put(JDBCDataStoreFactory.DBTYPE.key, layerGroupDsView.getDbType());
+        cqlDsParams.put(JDBCDataStoreFactory.HOST.key, host);
+        cqlDsParams.put(JDBCDataStoreFactory.PORT.key, port);
+        cqlDsParams.put(JDBCDataStoreFactory.USER.key, layerGroupDsView.getUserName());
+        cqlDsParams.put(JDBCDataStoreFactory.PASSWD.key, layerGroupDsView.getUserPassword());
+        cqlDsParams.put("tableName", layerGroupDsView.getTableName());
 
-        cqlDsParams.put(JDBCDataStoreFactory.HOST.key, geoDs.getHost());
-        cqlDsParams.put(JDBCDataStoreFactory.PORT.key, geoDs.getPort());
-        cqlDsParams.put(JDBCDataStoreFactory.USER.key, geoDs.getUserName());
-        cqlDsParams.put(JDBCDataStoreFactory.PASSWD.key, geoDs.getUserPassword());
-        cqlDsParams.put("tableName", geoDs.getTableName());
 
-        //组装排序参数
-        Map<String, Object> sortParams = new HashMap<String, Object>();
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+
+        if(filterCqlStr.length() >0){
+
+            mapParams.put("cql", filterCqlStr.toString());
+        }
+
 
-        PageResult pageResult = ecqlService.cqlQuery4Mysql(cqlDsParams, filterCqlStr.toString(), sortParams, null);
+        PageResult pageResult = ecqlService.cqlQuery(cqlDsParams, mapParams);
 
         if (pageResult.getRecordCount() > 0) {
 

+ 20 - 9
tile-web/src/main/java/cn/com/taiji/web/controller/TileWebController.java

@@ -3,7 +3,8 @@ package cn.com.taiji.web.controller;
 
 
 import cn.com.taiji.common.domain.Result;
-import cn.com.taiji.cql.model.GeoDataSource;
+import cn.com.taiji.common.model.LayerGroupDsView;
+import cn.com.taiji.common.model.LayerStyleView;
 import cn.com.taiji.cql.model.GeoRequestParam;
 import cn.com.taiji.tile.service.ITileService;
 import cn.com.taiji.web.service.IGeoDataSourceService;
@@ -20,10 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 图层通用查询控制器
@@ -62,13 +60,26 @@ public class TileWebController {
 
             try{
 
-                GeoDataSource geoDs = geoDataSourceService.layerCodeGeoDataSource(geoRequestParam.getLayers());
+                List<LayerGroupDsView> layerGroupDsViewList = geoDataSourceService.layerCodeGeoDataSource(geoRequestParam.getLayers());
 
-                if(geoDs !=null){
+                if(layerGroupDsViewList !=null){
 
-                    byte[] ret = tileService.tileData(geoRequestParam,geoDs);
+                    for(LayerGroupDsView layerGroupDsView:layerGroupDsViewList){
 
-                    responseWrite(response, "image/png", ret);
+
+                        List<LayerStyleView> layerStyleViewList = new ArrayList<LayerStyleView>();
+
+                        if(layerGroupDsView.getLayerCode() !=null && !"".equals(layerGroupDsView.getLayerCode())){
+
+                            layerStyleViewList = geoDataSourceService.layerCodeShapeStyle(layerGroupDsView.getLayerCode());
+                        }
+
+
+                        byte[] ret = tileService.tileData(geoRequestParam,layerGroupDsView,layerStyleViewList);
+
+                        responseWrite(response, "image/png", ret);
+
+                    }
 
 
                 }else{

+ 10 - 5
tile-web/src/main/java/cn/com/taiji/web/service/IGeoDataSourceService.java

@@ -2,12 +2,11 @@ package cn.com.taiji.web.service;
 
 import cn.com.taiji.common.domain.PageResult;
 import cn.com.taiji.common.domain.Result;
-import cn.com.taiji.cql.model.GeoDataSource;
-import cn.com.taiji.web.vo.DeviceVo;
-import cn.com.taiji.web.vo.EnterpriseVo;
-import org.springframework.web.bind.annotation.RequestBody;
+import cn.com.taiji.common.model.LayerGroupDsView;
+import cn.com.taiji.common.model.LayerStyleView;
 
 import javax.sql.DataSource;
+import java.util.List;
 import java.util.Map;
 
 public interface IGeoDataSourceService {
@@ -16,7 +15,13 @@ public interface IGeoDataSourceService {
      * 获取图层代码对应的数据源信息
      * @return
      */
-    GeoDataSource layerCodeGeoDataSource(String layerCode) throws Exception;
+    List<LayerGroupDsView> layerCodeGeoDataSource(String layerCode) throws Exception;
+
+    /**
+     * 获取图层代码对应的样式信息
+     * @return
+     */
+    List<LayerStyleView> layerCodeShapeStyle(String layerCode) throws Exception;
 
     DataSource defaultDataSource() throws Exception;
 

+ 51 - 11
tile-web/src/main/java/cn/com/taiji/web/service/impl/EnterpriseServiceImpl.java

@@ -2,7 +2,6 @@ package cn.com.taiji.web.service.impl;
 
 import cn.com.taiji.common.domain.PageResult;
 import cn.com.taiji.common.domain.Result;
-import cn.com.taiji.cql.model.GeoDataSource;
 import cn.com.taiji.cql.service.IECqlService;
 import cn.com.taiji.cql.service.ISqlService;
 import cn.com.taiji.web.config.EnterpriseConfig;
@@ -55,14 +54,6 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
         entDsParams.put(JDBCDataStoreFactory.PASSWD.key, enterpriseConfig.getDsPassword());
         entDsParams.put("tableName", enterpriseConfig.getEnterprise());
 
-        //组装分页参数
-        Map<String, Object> pageParams = new HashMap<String, Object>();
-        pageParams.put("pageSize",enterpriseVo.getPageSize());
-        pageParams.put("pageNumber",enterpriseVo.getPageNumber());
-
-        Map<String, Object> sortParams = new HashMap<String, Object>();
-        sortParams.put("qymc","asc");
-
         //组转cql查询条件
         StringBuffer filterCql = new StringBuffer();
         if(enterpriseVo.getEntName() !=null && !"".equals(enterpriseVo.getEntName())){
@@ -85,9 +76,51 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
 
         }
 
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+
+        if(filterCql.length() >0){
+
+            mapParams.put("cql", filterCql.toString());
+        }
+
+        //组装分页参数
+        mapParams.put("pageSize",enterpriseVo.getPageSize());
+        mapParams.put("pageNumber",enterpriseVo.getPageNumber());
+
+        Map<String, Object> sortMaps = new HashMap<String, Object>();
+        sortMaps.put("qymc","asc");
+        mapParams.put("sort",JSONObject.toJSONString(sortMaps));
+
         System.out.println("查询条件:"+filterCql.toString());
 
-        return ecqlService.cqlQuery4Mysql(entDsParams,filterCql.toString(),sortParams,pageParams);
+        PageResult pageResult = ecqlService.cqlQuery(entDsParams,mapParams);
+
+        List<EnterpriseInfo> enterpriseInfoList = new ArrayList<EnterpriseInfo>();
+
+        if(pageResult.getResp_code() ==0) {
+
+            List<Map<String, Object>> dataList = (List<Map<String, Object>>) pageResult.getDatas();
+
+            for (Map<String, Object> dataMap : dataList) {
+
+                if (dataMap.containsKey("location")) {
+
+                    dataMap.remove("location");
+
+                }
+
+                EnterpriseInfo enterpriseInfo = JSONObject.parseObject(JSONObject.toJSONString(dataMap), EnterpriseInfo.class);
+                enterpriseInfo.setDataId("qy_"+enterpriseInfo.getId());
+
+                enterpriseInfoList.add(enterpriseInfo);
+            }
+        }
+
+        pageResult.setDatas(enterpriseInfoList);
+
+
+
+        return pageResult;
     }
 
     public String transEntTypeListToSqlString(List<String> entTypeList) {
@@ -173,9 +206,16 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
 
         filterCql.append("(DWITHIN(location," + wkt + ", "+deviceVo.getRadius()+", kilometers))");
 
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+
+        if(filterCql.length() >0){
+
+            mapParams.put("cql", filterCql.toString());
+        }
+
 
 
-        PageResult pageResult = ecqlService.cqlQuery4Mysql(entDsParams,filterCql.toString(),null,null);
+        PageResult pageResult = ecqlService.cqlQuery(entDsParams,mapParams);
 
         List<DeviceInfo> deviceInfoList = new ArrayList<DeviceInfo>();
 

+ 65 - 22
tile-web/src/main/java/cn/com/taiji/web/service/impl/GeoDataSourceServiceImpl.java

@@ -2,7 +2,8 @@ package cn.com.taiji.web.service.impl;
 
 import cn.com.taiji.common.domain.PageResult;
 import cn.com.taiji.common.domain.Result;
-import cn.com.taiji.cql.model.GeoDataSource;
+import cn.com.taiji.common.model.LayerGroupDsView;
+import cn.com.taiji.common.model.LayerStyleView;
 import cn.com.taiji.cql.service.IECqlService;
 import cn.com.taiji.web.config.GeoConfig;
 import cn.com.taiji.web.service.IGeoDataSourceService;
@@ -18,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.sql.DataSource;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Slf4j
 @Service
@@ -35,42 +33,87 @@ public class GeoDataSourceServiceImpl implements IGeoDataSourceService {
 
 
     @Override
-    public GeoDataSource layerCodeGeoDataSource(String layerCode) throws Exception{
+    public List<LayerGroupDsView> layerCodeGeoDataSource(String layerCode) throws Exception{
 
 
-        //1先根据图层代码获取对应的数据源
-        Map<String, Object> mapParams = new HashMap<String, Object>();
-        mapParams.put(JDBCDataStoreFactory.DATABASE.key, geoConfig.getDsBase());
-        mapParams.put(JDBCDataStoreFactory.DBTYPE.key, geoConfig.getDbType());
+        List<LayerGroupDsView> layerGroupDsViewList = new ArrayList<LayerGroupDsView>();
 
-        mapParams.put(JDBCDataStoreFactory.HOST.key, geoConfig.getDsIp());
-        mapParams.put(JDBCDataStoreFactory.PORT.key, geoConfig.getDsPort());
-        mapParams.put(JDBCDataStoreFactory.USER.key, geoConfig.getDsUsername());
-        mapParams.put(JDBCDataStoreFactory.PASSWD.key, geoConfig.getDsPassword());
-        mapParams.put("tableName", "cql_data_source");
+        Map<String, Object> dsParams = new HashMap<String, Object>();
+        dsParams.put(JDBCDataStoreFactory.DATABASE.key, geoConfig.getDsBase());
+        dsParams.put(JDBCDataStoreFactory.DBTYPE.key, geoConfig.getDbType());
 
-        String layerCodeCql = "layer_code='"+layerCode+"'";
+        dsParams.put(JDBCDataStoreFactory.HOST.key, geoConfig.getDsIp());
+        dsParams.put(JDBCDataStoreFactory.PORT.key, geoConfig.getDsPort());
+        dsParams.put(JDBCDataStoreFactory.USER.key, geoConfig.getDsUsername());
+        dsParams.put(JDBCDataStoreFactory.PASSWD.key, geoConfig.getDsPassword());
+        dsParams.put("tableName", "layer_group_ds_view");
 
-        Map<String, Object> sortParams = new HashMap<String, Object>();
 
-        PageResult pageResult = ecqlService.cqlQuery4Mysql(mapParams,layerCodeCql,sortParams,null);
+        String layerCodeCql = "(group_code ='"+layerCode+"' or layer_code='"+layerCode+"')";
+
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+        mapParams.put("cql", layerCodeCql);
+
+        Map<String, Object> sortMaps = new HashMap<String, Object>();
+        sortMaps.put("sort","asc");
+        mapParams.put("sort",JSONObject.toJSONString(sortMaps));
+
+        PageResult pageResult = ecqlService.cqlQuery(dsParams,mapParams);
 
         if(pageResult.getRecordCount() >0){
 
             List<Map<String, Object>> dataSourceList = (List<Map<String, Object>>) pageResult.getDatas();
 
-            GeoDataSource gds = JSONObject.parseObject(JSONObject.toJSONString(dataSourceList.get(0)), GeoDataSource.class);
-
-            return gds;
+            layerGroupDsViewList = JSONObject.parseArray(JSONObject.toJSONString(dataSourceList), LayerGroupDsView.class);
 
         }
 
-        return null;
+        return layerGroupDsViewList;
 
 
 
     }
 
+    @Override
+    public List<LayerStyleView> layerCodeShapeStyle(String layerCode) throws Exception {
+
+        List<LayerStyleView> layerStyleViewList = new ArrayList<LayerStyleView>();
+
+        Map<String, Object> dsParams = new HashMap<String, Object>();
+        dsParams.put(JDBCDataStoreFactory.DATABASE.key, geoConfig.getDsBase());
+        dsParams.put(JDBCDataStoreFactory.DBTYPE.key, geoConfig.getDbType());
+
+        dsParams.put(JDBCDataStoreFactory.HOST.key, geoConfig.getDsIp());
+        dsParams.put(JDBCDataStoreFactory.PORT.key, geoConfig.getDsPort());
+        dsParams.put(JDBCDataStoreFactory.USER.key, geoConfig.getDsUsername());
+        dsParams.put(JDBCDataStoreFactory.PASSWD.key, geoConfig.getDsPassword());
+        dsParams.put("tableName", "layer_style_view");
+
+
+        String layerCodeCql = "layer_code='"+layerCode+"'";
+
+        Map<String, Object> mapParams = new HashMap<String, Object>();
+        mapParams.put("cql", layerCodeCql);
+
+        Map<String, Object> sortMaps = new HashMap<String, Object>();
+        sortMaps.put("sort","asc");
+        mapParams.put("sort",JSONObject.toJSONString(sortMaps));
+
+        Map<String, Object> sortParams = new HashMap<String, Object>();
+
+        PageResult pageResult = ecqlService.cqlQuery(dsParams,mapParams);
+
+        if(pageResult.getRecordCount() >0){
+
+            List<Map<String, Object>> dataSourceList = (List<Map<String, Object>>) pageResult.getDatas();
+
+            layerStyleViewList = JSONObject.parseArray(JSONObject.toJSONString(dataSourceList), LayerStyleView.class);
+
+        }
+
+        return layerStyleViewList;
+    }
+
     public DataSource defaultDataSource() throws Exception{
 
         //构建mysql数据库连接数据源--DataSource