Browse Source

迁移固定ip的api接口到执法中心

Memory_LG 7 tháng trước cách đây
mục cha
commit
c39bfb044e

+ 3 - 3
src/main/java/com/sooka/sponest/lawenforcement/device/service/impl/DeviceServiceImpl.java

@@ -5,9 +5,9 @@ import com.sooka.sponest.lawenforcement.device.domain.DeviceBO;
 import com.sooka.sponest.lawenforcement.device.domain.SensorEventVo;
 import com.sooka.sponest.lawenforcement.device.domain.StaticEntity;
 import com.sooka.sponest.lawenforcement.device.service.IDeviceService;
+import com.sooka.sponest.lawenforcement.feign.domain.VisuForestCloudCameraBO;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementDeviceService;
 import com.sooka.sponest.lawenforcement.feignClient.service.RemoteLawenforcementEventService;
-import com.sooka.sponest.monitor.api.RemoteDeviceService;
-import com.sooka.sponest.monitor.api.domain.VisuForestCloudCameraBO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,7 +52,7 @@ public class DeviceServiceImpl implements IDeviceService {
                  */
                 VisuForestCloudCameraBO cloudCameraBO = new VisuForestCloudCameraBO();
                 cloudCameraBO.setDeviceCode(deviceCode);
-                List<Map<String, Object>> data = SpringUtils.getBean(RemoteDeviceService.class).selectByCameraId(cloudCameraBO).getData();
+                List<Map<String, Object>> data = SpringUtils.getBean(RemoteEnforcementDeviceService.class).selectByCameraId(cloudCameraBO).getData();
                 //创建事件实体类
                 SensorEventVo sensorEventVo = new SensorEventVo(
                         StaticEntity.EVENT_TYPE,//事件分类(大类)

+ 119 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/domain/VisuForestCloudCameraBO.java

@@ -0,0 +1,119 @@
+package com.sooka.sponest.lawenforcement.feign.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ *
+ *监控中心-摄像头信息 实体类
+ *
+ */
+@Getter
+@Setter
+public class VisuForestCloudCameraBO extends BaseEntity {
+
+
+
+    /** 主键id */
+    private String id;
+
+    //设备编码
+    private String deviceCode;
+
+    private String dataStatus;
+
+    /** 数据所属部门(政或党的id) */
+
+    private Long dataDeptId;
+
+    /** 数据所属部门id */
+
+    private Long deptId;
+
+    /** 数据所属部门(政或党的名称) */
+
+    private String deptName;
+
+    /** 摄像头名称 */
+
+    private String cameraName;
+
+    /** ip */
+
+    private String cameraIp;
+
+    /** 端口 */
+
+    private Long cameraPort;
+
+    /** 账号 */
+
+    private String cameraAccount;
+
+    /** 密码 */
+
+    private String cameraPasword;
+
+    /** 摄像头编码 */
+
+    private String cameraCode;
+
+    /** 摄像头厂家(海康、大华) */
+
+    private String cameraFactory;
+
+    /** 所属区域 */
+
+    private String cameraRegion;
+
+    /** 半径 */
+
+    private String cameraRadius;
+
+    /** 高度 */
+
+    private String height;
+
+    /** 经度 */
+
+    private String longitude;
+
+    /** 维度 */
+
+    private String latitude;
+
+    /** 事件类型 */
+
+    private String eventType;
+    /** 通道 */
+    private String channelCode;
+
+    private String operatorType;
+
+    private String cameraUse;
+
+    /** 维度 */
+
+    private String cameraType;
+    private String channelNum;
+    private String workingStatus;
+    private String offlineReason;
+    /**
+     * 经度
+     */
+    private String gpsX;
+    /**
+     * 纬度
+     */
+    private String gpsY;
+    /**
+     * 纬度
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date escalationTime;
+
+}

+ 39 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/factory/RemoteEnforcementConfigFallbackFactory.java

@@ -0,0 +1,39 @@
+package com.sooka.sponest.lawenforcement.feign.factory;
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementConfigService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 参数设置服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteEnforcementConfigFallbackFactory implements FallbackFactory<RemoteEnforcementConfigService> {
+
+    private static final Logger log = LoggerFactory.getLogger(RemoteEnforcementConfigFallbackFactory.class);
+
+    @Override
+    public RemoteEnforcementConfigService create(Throwable throwable) {
+        log.error("参数设置服务调用失败:{}", throwable.getMessage());
+
+        return new RemoteEnforcementConfigService() {
+            @Override
+            public R<String> remotegetConfigKey(String configKey) {
+                return R.fail("获取参数设置失败:" + throwable.getMessage());
+            }
+
+            @Override
+            public R<Map<String, String>> remotegetConfigMap(List<String> keys) {
+                return R.fail("获取参数设置失败:" + throwable.getMessage());
+            }
+        };
+    }
+}

+ 34 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/factory/RemoteEnforcementDeptFallbackFactory.java

@@ -0,0 +1,34 @@
+package com.sooka.sponest.lawenforcement.feign.factory;
+
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementDeptService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 文件服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteEnforcementDeptFallbackFactory implements FallbackFactory<RemoteEnforcementDeptService> {
+
+    private static final Logger log = LoggerFactory.getLogger(RemoteEnforcementDeptFallbackFactory.class);
+
+    @Override
+    public RemoteEnforcementDeptService create(Throwable throwable) {
+        log.error("部门服务调用失败:{}", throwable.getMessage());
+
+        return new RemoteEnforcementDeptService() {
+            @Override
+            public AjaxResult selectDeptListByDeptNames(String[] deptName) {
+                return null;
+            }
+        };
+    }
+}

+ 31 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/factory/RemoteEnforcementDeviceFallbackFactory.java

@@ -0,0 +1,31 @@
+package com.sooka.sponest.lawenforcement.feign.factory;
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.lawenforcement.feign.domain.VisuForestCloudCameraBO;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementDeviceService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class RemoteEnforcementDeviceFallbackFactory implements FallbackFactory<RemoteEnforcementDeviceService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteEnforcementDeviceService.class);
+
+    @Override
+    public RemoteEnforcementDeviceService create(Throwable throwable) {
+        log.error("监控中心服务调用失败:{}", throwable.getMessage());
+
+        return new RemoteEnforcementDeviceService() {
+
+            @Override
+            public R<List<Map<String, Object>>> selectByCameraId(VisuForestCloudCameraBO bo) {
+                return null;
+            }
+
+        };
+    }
+}

+ 39 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/service/RemoteEnforcementConfigService.java

@@ -0,0 +1,39 @@
+package com.sooka.sponest.lawenforcement.feign.service;
+
+import com.ruoyi.common.core.constant.ServiceNameConstants;
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.lawenforcement.feign.factory.RemoteEnforcementConfigFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 参数设置服务
+ *
+ * @author ruoyi
+ */
+@FeignClient(contextId = "remoteEnforcementConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteEnforcementConfigFallbackFactory.class,url = "${sooka.service.system}")
+public interface RemoteEnforcementConfigService {
+
+    /**
+     * 获取参数设置
+     *
+     * @param configKey
+     * @return
+     */
+    @PostMapping("/config/remotegetConfigKey")
+    R<String> remotegetConfigKey(@RequestBody String configKey);
+
+    /**
+     * 获取参数设置
+     *
+     * @param keys
+     * @return
+     */
+    @PostMapping("/config/getConfigMap")
+    R<Map<String, String>> remotegetConfigMap(@RequestParam("keys") List<String> keys);
+}

+ 19 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/service/RemoteEnforcementDeptService.java

@@ -0,0 +1,19 @@
+package com.sooka.sponest.lawenforcement.feign.service;
+
+import com.ruoyi.common.core.constant.ServiceNameConstants;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.sooka.sponest.lawenforcement.feign.factory.RemoteEnforcementDeptFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 文件服务
+ *
+ * @author ruoyi
+ */
+@FeignClient(contextId = "remoteEnforcementDeptService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteEnforcementDeptFallbackFactory.class, url = "${sooka.service.system}")
+public interface RemoteEnforcementDeptService {
+
+    @PostMapping("/dept/selectDeptListByDeptNames")
+    AjaxResult selectDeptListByDeptNames(@RequestParam("deptName") String[] deptName);
+}

+ 27 - 0
src/main/java/com/sooka/sponest/lawenforcement/feign/service/RemoteEnforcementDeviceService.java

@@ -0,0 +1,27 @@
+package com.sooka.sponest.lawenforcement.feign.service;
+
+import com.ruoyi.common.core.constant.ServiceNameConstants;
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.lawenforcement.feign.domain.VisuForestCloudCameraBO;
+import com.sooka.sponest.lawenforcement.feign.factory.RemoteEnforcementDeviceFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+import java.util.Map;
+
+@FeignClient(contextId = "RemoteEnforcementDeviceService",
+        value = ServiceNameConstants.MONITOR_SERVICE,
+        fallbackFactory = RemoteEnforcementDeviceFallbackFactory.class
+        , url = "${sooka.service.monitor}")
+public interface RemoteEnforcementDeviceService {
+
+    /**
+     * 获取执法设备接口
+     * @param bo
+     * @return
+     */
+    @PostMapping("/camera/selectRecorderByDeptId")
+    R<List<Map<String,Object>>> selectByCameraId(@RequestBody VisuForestCloudCameraBO bo);
+}

+ 2 - 1
src/main/java/com/sooka/sponest/lawenforcement/lawCase/service/impl/LawenforcementCaseServiceImpl.java

@@ -8,6 +8,7 @@ import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
 import com.ruoyi.common.datascope.base.service.BaseService;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.system.api.RemoteConfigService;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementConfigService;
 import com.sooka.sponest.lawenforcement.lawCase.domain.LawenforcementAttach;
 import com.sooka.sponest.lawenforcement.lawCase.domain.LawenforcementCase;
 import com.sooka.sponest.lawenforcement.lawCase.domain.LawenforcementCaseLog;
@@ -60,7 +61,7 @@ public class LawenforcementCaseServiceImpl extends BaseService implements ILawen
         for (LawenforcementAttach file : fileList) {
             if (StringUtils.isNotEmpty(file.getAttachPath())) {
                 StringBuilder newDiles = new StringBuilder();
-                String fileurl = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey(DataConstants.DOWNLOAD_URL).getData();
+                String fileurl = SpringUtils.getBean(RemoteEnforcementConfigService.class).remotegetConfigKey(DataConstants.DOWNLOAD_URL).getData();
                 String filename = file.getFileName();
                 String group = file.getAttachPath().substring(0, file.getAttachPath().indexOf('/'));
                 newDiles.append(fileurl).append("Download?fileName=").append(filename).append("&&group=").append(group).append("&&path=").append(file.getAttachPath().substring(file.getAttachPath().indexOf('/') + 1)).append("+").append(filename);

+ 3 - 3
src/main/java/com/sooka/sponest/lawenforcement/record/controller/LawenforcementRecordController.java

@@ -11,12 +11,12 @@ import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.sooka.sponest.lawenforcement.feign.domain.VisuForestCloudCameraBO;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementDeviceService;
 import com.sooka.sponest.lawenforcement.record.domain.LawenforcementRecord;
 import com.sooka.sponest.lawenforcement.record.domain.bo.LawenforcementBindDeviceBO;
 import com.sooka.sponest.lawenforcement.record.domain.bo.LawenforcementFillFormBO;
 import com.sooka.sponest.lawenforcement.record.service.ILawenforcementRecordService;
-import com.sooka.sponest.monitor.api.RemoteDeviceService;
-import com.sooka.sponest.monitor.api.domain.VisuForestCloudCameraBO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -118,7 +118,7 @@ public class LawenforcementRecordController extends BaseController {
         if(visuForestCloudCameraBO.getDeptId() == null){
             visuForestCloudCameraBO.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
         }
-        return SpringUtils.getBean(RemoteDeviceService.class).selectByCameraId(visuForestCloudCameraBO);
+        return SpringUtils.getBean(RemoteEnforcementDeviceService.class).selectByCameraId(visuForestCloudCameraBO);
     }
 
     /**

+ 4 - 2
src/main/java/com/sooka/sponest/lawenforcement/record/service/impl/LawenforcementRecordServiceImpl.java

@@ -11,6 +11,8 @@ import com.ruoyi.system.api.RemoteConfigService;
 import com.ruoyi.system.api.RemoteDeptService;
 import com.sooka.sponest.lawenforcement.base.service.impl.BaseServiceImpl;
 import com.sooka.sponest.lawenforcement.device.service.IDeviceService;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementConfigService;
+import com.sooka.sponest.lawenforcement.feign.service.RemoteEnforcementDeptService;
 import com.sooka.sponest.lawenforcement.person.domain.LawenforcementPerson;
 import com.sooka.sponest.lawenforcement.person.mapper.LawenforcementPersonMapper;
 import com.sooka.sponest.lawenforcement.record.domain.LawenforcementRecord;
@@ -319,7 +321,7 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
         //设置任务结束时间
         int i = recordMapper.updateRecordLogEndTime(record);
 
-        Boolean isOpen = Boolean.valueOf(SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("lawenforcement_open").getData());
+        Boolean isOpen = Boolean.valueOf(SpringUtils.getBean(RemoteEnforcementConfigService.class).remotegetConfigKey("lawenforcement_open").getData());
         if (isOpen) {
             //从正在执行任务的设备集合中移除信息
             deviceService.removeOpenedDevice(record.getDeviceId());
@@ -407,7 +409,7 @@ public class LawenforcementRecordServiceImpl extends BaseServiceImpl implements
         String[] deptNames = deptNameSet.toArray(new String[0]);
 
         //根据部门名称查询部门id
-        AjaxResult ajaxResult = SpringUtils.getBean(RemoteDeptService.class).selectDeptListByDeptNames(deptNames);
+        AjaxResult ajaxResult = SpringUtils.getBean(RemoteEnforcementDeptService.class).selectDeptListByDeptNames(deptNames);
         //取出部门集合
         List<Map<String, Object>> deptList = (List<Map<String, Object>>) ajaxResult.get("data");
         //如果部门集合不为空,则转换为key-value    部门名称-部门id