liwh 1 год назад
Родитель
Сommit
fa0b3a596a

+ 8 - 4
cql-service/src/main/java/cn/com/taiji/cql/service/impl/ECqlServiceImpl.java

@@ -211,15 +211,19 @@ public class ECqlServiceImpl implements IECqlService{
             }
         }
 
-        if(count >0){
+        int respCode = 0;
 
-            return PageResult.<List<Map<String, Object>>>builder().datas(dataList).resp_code(0).resp_msg("操作成功!").pageNumber(pageNumber).pageCount(pageCount).recordCount(count).build();
+        String respMsg = "操作成功";
 
-        }else{
+        if(count == 0){
+
+            respCode = 1;
+            respMsg = "操作成功,但没有查找到记录!";
 
-            return PageResult.<List<Map<String, Object>>>builder().datas(dataList).resp_code(1).resp_msg("操作成功,但没有查找到记录!").pageNumber(pageNumber).pageCount(pageCount).recordCount(count).build();
         }
 
+        return PageResult.<List<Map<String, Object>>>builder().datas(dataList).resp_code(respCode).resp_msg(respMsg).pageSize(pageSize).pageNumber(pageNumber).pageCount(pageCount).recordCount(count).build();
+
 
     }
 }

+ 5 - 2
tile-web/src/main/java/cn/com/taiji/web/config/EnterpriseConfig.java

@@ -23,8 +23,11 @@ public class EnterpriseConfig {
     @Value("${ent.ds.basename}")
     private String dsBaseName;
 
-    @Value("${ent.ds.tablename}")
-    private String dsTableName;
+    @Value("${ent.ds.enterprise}")
+    private String enterprise;
+
+    @Value("${ent.ds.device}")
+    private String device;
 
     @Value("${ent.ds.dbtype}")
     private String dbType;

+ 89 - 0
tile-web/src/main/java/cn/com/taiji/web/model/DeviceInfo.java

@@ -0,0 +1,89 @@
+package cn.com.taiji.web.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class DeviceInfo implements Serializable {
+
+    /**
+     * 监控资源唯一标识
+     */
+    private String pn;
+
+    /**
+     * 协转号
+     */
+    private String groupid;
+
+    /**
+     * 监控号
+     */
+    private String monitorid;
+
+    /**
+     * 设备/区域/系统名称(必选)
+     */
+    private String name;
+
+    /**
+     * 设备的在线状态,1代表在线,0代表离线,国标状态同步是必用
+     */
+    private String online;
+
+    /**
+     * 是否有录像
+     */
+    private String savestatus;
+
+    /**
+     * 标识摄像机类型:1-球机;2-半球;3-固定枪机;4-遥控枪机。当目录项为摄像机时可选。
+     */
+    private String ptztype;
+
+    /**
+     * 设备ID
+     */
+    private String deviceid;
+
+    /**
+     * 对应组织机构里面的areacode用于统计和展示
+     */
+    private String areacode;
+
+    /**
+     * 经度(可选)
+     */
+    private String longitude;
+
+    /**
+     * 纬度(可选)
+     */
+    private String latitude;
+
+    /**
+     * 是否故障(0没有故障 1有故障)
+     */
+    private String faultedflag;
+
+    /**
+     * 设备可用状态,ON代表启用,OFF代表关闭(必选)
+     */
+    private String status;
+
+    /**
+     * 是否是前端摄像头,用于列表展示,1代表是,0代表其它
+     */
+    private String isfront;
+
+    /**
+     * 视频点位分类
+     */
+    private String type;
+
+    /**
+     * 行政规划中心编码
+     */
+    private String civilcode;
+}

+ 55 - 0
tile-web/src/main/java/cn/com/taiji/web/model/EnterpriseInfo.java

@@ -0,0 +1,55 @@
+package cn.com.taiji.web.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class EnterpriseInfo implements Serializable {
+
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 企业名称
+     */
+    private String qymc;
+
+    /**
+     * 企业经营类型
+     */
+    private String qykx;
+
+    /**
+     * 统一社会信息代码
+     */
+    private String uniscid;
+
+    /**
+     * 位置
+     */
+    private String dom;
+
+    /**
+     * 法人姓名
+     */
+    private String lerep;
+
+    /**
+     * 纬度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 日期
+     */
+    private String dt;
+
+}

+ 33 - 19
tile-web/src/main/java/cn/com/taiji/web/service/impl/EnterpriseServiceImpl.java

@@ -2,16 +2,20 @@ 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.web.config.EnterpriseConfig;
+import cn.com.taiji.web.model.DeviceInfo;
 import cn.com.taiji.web.service.IEnterpriseService;
 import cn.com.taiji.web.vo.DeviceVo;
 import cn.com.taiji.web.vo.EnterpriseVo;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.geotools.jdbc.JDBCDataStoreFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -38,22 +42,21 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
         entDsParams.put(JDBCDataStoreFactory.PORT.key, enterpriseConfig.getDsPort());
         entDsParams.put(JDBCDataStoreFactory.USER.key, enterpriseConfig.getDsUserName());
         entDsParams.put(JDBCDataStoreFactory.PASSWD.key, enterpriseConfig.getDsPassword());
-        entDsParams.put("tableName", enterpriseConfig.getDsTableName());
-
-        //组装排序参数
-        Map<String, Object> sortParams = new HashMap<String, Object>();
-        sortParams.put("sort","asc");
+        entDsParams.put("tableName", enterpriseConfig.getEnterprise());
 
         //组装分页参数
         Map<String, Object> pageParams = new HashMap<String, Object>();
         pageParams.put("pageSize",enterpriseVo.getPageSize());
-        pageParams.put("pageNumber",enterpriseVo.getPageSize());
+        pageParams.put("pageNumber",enterpriseVo.getPageNumber());
+
+        Map<String, Object> sortParams = new HashMap<String, Object>();
+        sortParams.put("id","desc");
 
         //组转cql查询条件
         StringBuffer filterCql = new StringBuffer();
         if(enterpriseVo.getEntName() !=null && !"".equals(enterpriseVo.getEntName())){
 
-            filterCql.append("(entName like '%"+enterpriseVo.getEntName()+"%')");
+            filterCql.append("(qymc like '%"+enterpriseVo.getEntName()+"%')");
 
         }
 
@@ -61,10 +64,10 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
 
             if(filterCql.length() >0){
 
-                filterCql.append(" and (entType = '"+enterpriseVo.getEntType()+"')");
+                filterCql.append(" and (qykx = '"+enterpriseVo.getEntType()+"')");
             }else{
 
-                filterCql.append(" (entType = '"+enterpriseVo.getEntType()+"')");
+                filterCql.append(" (qykx = '"+enterpriseVo.getEntType()+"')");
             }
 
         }
@@ -86,7 +89,7 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
         entDsParams.put(JDBCDataStoreFactory.PORT.key, enterpriseConfig.getDsPort());
         entDsParams.put(JDBCDataStoreFactory.USER.key, enterpriseConfig.getDsUserName());
         entDsParams.put(JDBCDataStoreFactory.PASSWD.key, enterpriseConfig.getDsPassword());
-        entDsParams.put("tableName", enterpriseConfig.getDsTableName());
+        entDsParams.put("tableName", enterpriseConfig.getDevice());
 
         //组转cql查询条件
         StringBuffer filterCql = new StringBuffer();
@@ -95,23 +98,34 @@ public class EnterpriseServiceImpl implements IEnterpriseService {
 
         filterCql.append("(DWITHIN(location," + wkt + ", "+deviceVo.getRadius()+", kilometers))");
 
-        if(deviceVo.getEntCode() !=null && !"".equals(deviceVo.getEntCode())){
 
-            if(filterCql.length() >0){
 
-                filterCql.append(" and (entCode = '"+deviceVo.getEntCode()+"')");
-            }else{
+        PageResult pageResult = ecqlService.cqlQuery4Mysql(entDsParams,filterCql.toString(),null,null);
 
-                filterCql.append(" (entCode = '"+deviceVo.getEntCode()+"')");
-            }
+        List<DeviceInfo> deviceInfoList = new ArrayList<DeviceInfo>();
+
+        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");
+
+                }
+
+                DeviceInfo deviceInfo = JSONObject.parseObject(JSONObject.toJSONString(dataMap), DeviceInfo.class);
+                deviceInfoList.add(deviceInfo);
+
+            }
         }
 
-        System.out.println("查询条件:"+filterCql.toString());
+        System.out.println("查询条件:"+filterCql.toString()+" 记录数:"+deviceInfoList.size());
 
-        PageResult pageResult = ecqlService.cqlQuery4Mysql(entDsParams,filterCql.toString(),null,null);
 
-        return Result.of(pageResult.getDatas().toString(),pageResult.getResp_code(),pageResult.getResp_msg());
+        return Result.of(deviceInfoList,pageResult.getResp_code(),pageResult.getResp_msg());
 
 
     }

+ 0 - 5
tile-web/src/main/java/cn/com/taiji/web/vo/DeviceVo.java

@@ -20,9 +20,4 @@ public class DeviceVo implements Serializable {
      * 半径(单位为千米)
      */
     private double radius;
-
-    /**
-     * 企业代码
-     */
-    private String entCode;
 }

+ 2 - 1
tile-web/src/main/resources/application-test.properties

@@ -14,6 +14,7 @@ ent.ds.port=7306
 ent.ds.username=root
 ent.ds.password=Ucsp123#
 ent.ds.basename=geo
-ent.ds.tablename=seat_fk_realtimetrajectory_data
+ent.ds.enterprise=lgsqy
+ent.ds.device=stg_view_deviceinfo_df
 ent.ds.dbtype = mysql