Kaynağa Gözat

删除北向服务MQ相关代码

jingyuanchao 1 yıl önce
ebeveyn
işleme
51e571e751

+ 0 - 7
soc-modules/soc-modules-mediator/pom.xml

@@ -79,13 +79,6 @@
             <version>${soc.version}</version>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
-            <version>3.0.1.RELEASE</version>
-        </dependency>
-
-
         <!--lombok-->
         <dependency>
             <groupId>org.projectlombok</groupId>

+ 0 - 5
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/controller/DataController.java

@@ -30,8 +30,6 @@ public class DataController {
 
 
     @Resource
-    private RabbitMsgIdService rabbitMsgIdService;
-    @Resource
     private IIotDeviceService iotDeviceService;
     @Resource
     private IIotDvrChannelService iotDvrChannelService;
@@ -69,7 +67,6 @@ public class DataController {
     @ApiOperation("设备信息同步")
     @PostMapping({"/api/data/equipmentList"})
     public ReceiveErrorDto equipmentList(String msgId, @RequestBody DataPageDto<DeviceDto> deviceReceivePageDto) {
-        rabbitMsgIdService.sendMsgId(msgId, "/data/equipmentList", "设备信息同步");
         LogUtils.BASE_INFO_EQUIPMENT.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "设备信息同步:/api/data/equipmentList/", msgId, JSON.toJSONString(deviceReceivePageDto));
         try {
             ReceiveErrorDto errorDto = iotDeviceService.saveData(deviceReceivePageDto, msgId);
@@ -97,7 +94,6 @@ public class DataController {
     @ApiOperation("通道信息同步")
     @PostMapping({"/api/data/channelList"})
     public ReceiveErrorDto channelList(String msgId, @RequestBody List<DeviceDto> deviceDtos) {
-        rabbitMsgIdService.sendMsgId(msgId, "/data/channelList", "通道信息同步");
         LogUtils.BASE_INFO_CHANNEL.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "通道信息同步:/api/data/channelList", msgId, JSONArray.toJSONString(deviceDtos));
         ReceiveErrorDto errorDto = new ReceiveErrorDto();
         try {
@@ -159,7 +155,6 @@ public class DataController {
     @ApiOperation("网络设备检测")
     @PostMapping({"/api/status/network"})
     ReceiveErrorDto network(String msgId, @RequestBody NetworkDeviceDetectionEditDto networkDeviceDetectionEditDto) {
-        rabbitMsgIdService.sendMsgId(msgId, "/status/network", "网络设备检测");
         LogUtils.STATUS_INFO_NETWORK.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "网络设备检测:/api/status/network", msgId, JSON.toJSONString(networkDeviceDetectionEditDto));
         ReceiveErrorDto result = ReceiveErrorDto.success();
         try {

+ 0 - 7
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/controller/ProtectionController.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.xunmei.mediator.api.service.IotAlarmDefenceAreaService;
 import com.xunmei.mediator.api.service.IotAlarmSubsystemService;
-import com.xunmei.mediator.api.service.RabbitMsgIdService;
 import com.xunmei.system.api.dto.DataPageDto;
 import com.xunmei.system.api.dto.protection.DefenceAreaDto;
 import com.xunmei.system.api.dto.protection.ProtectionEditDto;
@@ -12,7 +11,6 @@ import com.xunmei.system.api.dto.protection.ReceiveErrorDto;
 import com.xunmei.system.api.dto.protection.SensorDataDto;
 import com.xunmei.system.api.util.LogUtils;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -27,8 +25,6 @@ import javax.annotation.Resource;
 public class ProtectionController {
 
     @Resource
-    private RabbitMsgIdService rabbitMsgIdService;
-    @Resource
     private IotAlarmSubsystemService protectionService;
     @Resource
     private IotAlarmDefenceAreaService defenceAreService;
@@ -36,7 +32,6 @@ public class ProtectionController {
     @ApiOperation(value = "报警主机子系统及防区信息同步")
     @PostMapping({"/api/data/defenceareaList"})
     public ReceiveErrorDto defenceareaList(String msgId, @RequestBody DataPageDto<DefenceAreaDto> request) {
-        rabbitMsgIdService.sendMsgId(msgId, "/data/defenceareaList", "报警主机子系统及防区信息同步");
         LogUtils.BASE_INFO_DEFENCEAREA.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "报警主机子系统及防区信息同步:/api/data/defenceareaList", msgId, JSONArray.toJSONString(request));
         ReceiveErrorDto errorDto = ReceiveErrorDto.success();
         try {
@@ -66,7 +61,6 @@ public class ProtectionController {
     @ApiOperation("接收报警主机-子系统布撤防数据")
     @PostMapping({"/api/status/defencearea"})
     ReceiveErrorDto info(String msgId, @RequestBody ProtectionEditDto protectionEditDto) {
-        rabbitMsgIdService.sendMsgId(msgId, "/status/defencearea", "布撤防数据");
         LogUtils.STATUS_INFO_DEFENCEAREA.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "接收布防数据:/api/status/defencearea", msgId, JSON.toJSONString(protectionEditDto));
         ReceiveErrorDto errorDto = ReceiveErrorDto.success();
         try {
@@ -82,7 +76,6 @@ public class ProtectionController {
     @ApiOperation(value = "接收防区传感器报警信息")
     @PostMapping({"/api/status/sensor"})
     public ReceiveErrorDto sensor(String msgId, @RequestBody SensorDataDto request) {
-        rabbitMsgIdService.sendMsgId(msgId, "/status/sensor", "接收防区传感器报警信息");
         LogUtils.STATUS_INFO_STATUS_SENSOR.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "接收防区传感器报警信息:/api/status/sensor", msgId, JSON.toJSONString(request));
         ReceiveErrorDto errorDto = ReceiveErrorDto.success();
         try {

+ 0 - 7
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/controller/VideoDataController.java

@@ -33,8 +33,6 @@ public class VideoDataController {
     private IVideoDaysCheckService videoDaysCheckService;
     @Resource
     private IVideoDiagnosisRecordService videoDiagnosisRecordService;
-    @Autowired
-    private RabbitMsgIdService rabbitMsgIdService;
     @Resource
     IotDvrHardDiskDetectionService videoRecorderHardDiskDetectionService;
     @Resource
@@ -42,7 +40,6 @@ public class VideoDataController {
     @ApiOperation("录像完整性检查")
     @PostMapping({"/api/video/complete"})
     public ReceiveErrorDto complete( String msgId, @RequestBody VideoIntegrityCheckDto videoIntegrityCheckDto) {
-        rabbitMsgIdService.sendMsgId(msgId,"/video/complete","录像完整性检查");
 
         LogUtils.STATUS_INFO_VIDEO_COMPLETE.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "录像完整性检查:/api/video/complete", msgId, JSONArray.toJSONString(videoIntegrityCheckDto));
         ReceiveErrorDto result = ReceiveErrorDto.success();
@@ -67,7 +64,6 @@ public class VideoDataController {
     @ApiOperation("录像机天数检查")
     @PostMapping({"/api/video/daysInfo"})
     public ReceiveErrorDto daysInfo( String msgId, @RequestBody VideoDaysCheckDto videoDaysCheckDto) {
-        rabbitMsgIdService.sendMsgId(msgId,"/video/daysInfo","录像机天数检查");
         LogUtils.STATUS_INFO_VIDEO_DAYS.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "录像机天数检查:/api/video/daysInfo", msgId, JSONArray.toJSONString(videoDaysCheckDto));
         ReceiveErrorDto errorDto = ReceiveErrorDto.success();
         try {
@@ -84,7 +80,6 @@ public class VideoDataController {
     @ApiOperation("视频质量诊断结果")
     @PostMapping({"/api/video/diagnosis"})
     public ReceiveErrorDto plan( String msgId, @RequestBody VideoDiagnosisDto videoDiagnosisDto) {
-        rabbitMsgIdService.sendMsgId(msgId,"/video/diagnosis","视频质量诊断结果");
         LogUtils.STATUS_INFO_VIDEO_DIAGNOSIS.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "视频质量诊断结果:/api/video/diagnosis", msgId, JSONArray.toJSONString(videoDiagnosisDto));
         ReceiveErrorDto result = ReceiveErrorDto.success();
         if (ObjectUtil.isEmpty(videoDiagnosisDto.getOrganizationGuid())) {
@@ -106,7 +101,6 @@ public class VideoDataController {
     @ApiOperation("DVR硬盘空间信息同步")
     @PostMapping({"/api/data/dvrDiskList"})
     ReceiveErrorDto disksList( String msgId, @RequestBody DataPageDto<DvrDiskPageDto> dataPageDto) {
-        rabbitMsgIdService.sendMsgId(msgId, "/api/data/dvrDiskList", "DVR硬盘空间信息同步");
         LogUtils.BASE_INFO_DVR_DISK.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "DVR硬盘空间信息同步:/api/data/dvrDiskList", msgId, JSON.toJSONString(dataPageDto));
         ReceiveErrorDto result = ReceiveErrorDto.success();
         try {
@@ -123,7 +117,6 @@ public class VideoDataController {
     @ApiOperation("硬盘检测")
     @PostMapping({"/api/status/disks"})
     ReceiveErrorDto disks( String msgId, @RequestBody VideoRecorderHardDiskDetectionEditDto videoRecorderHardDiskDetectionEditDto) {
-        rabbitMsgIdService.sendMsgId(msgId, "/status/disks", "录像机硬盘检测");
         LogUtils.STATUS_INFO_DISKS.info("【北向接口-{}】【msgId:{}】【接收参数:{}】", "录像机硬盘检测:/api/status/disks", msgId, JSON.toJSONString(videoRecorderHardDiskDetectionEditDto));
         ReceiveErrorDto result = ReceiveErrorDto.success();
         try {

+ 0 - 88
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/service/RabbitMsgIdService.java

@@ -1,88 +0,0 @@
-package com.xunmei.mediator.api.service;
-
-import cn.hutool.core.date.DateUtil;
-import com.alibaba.fastjson.JSON;
-import com.rabbitmq.client.Channel;
-import com.xunmei.system.api.domain.north.NorthMsgId;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.IOException;
-import java.util.Date;
-
-@Service
-@Slf4j
-@EnableAsync
-public class RabbitMsgIdService {
-
-    public static final String QUEUE = "msg_id_brand_id_1.v1";
-
-    /**
-     * 创建消息队列
-     **/
-    @Bean
-    public org.springframework.amqp.core.Queue getQueue() {
-        return new org.springframework.amqp.core.Queue(QUEUE);
-    }
-
-    /**
-     * rabbitmq服务
-     */
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Autowired
-    private INorthMsgIdService northMsgIdService;
-
-    /**
-     * 给mq发送消息
-     *
-     * @param msgId
-     * @param interfacePath
-     * @param interfaceName
-     */
-    public void sendMsgId(String msgId, String interfacePath, String interfaceName) {
-        Date date = new Date();
-        String format = DateUtil.format(date, "yyyy-MM-dd");
-        NorthMsgId msg = new NorthMsgId();
-        msg.setMsgId(msgId);
-        msg.setInterfaceName(interfaceName);
-        msg.setInterfacePath(interfacePath);
-        msg.setYmd(format);
-        msg.setMsgDate(date);
-        log.info("发送消息:{}", JSON.toJSON(msg));
-        this.rabbitTemplate.convertAndSend(QUEUE, msg);
-    }
-
-
-    /**
-     * 通过监听的方式接收消息(注意这里方法是 final ,因为Spring开启代码,如果不设置final 会报异常)
-     *
-     * @param message 未折封的消息对象(非必需要)
-     */
-    @RabbitListener(queues = QUEUE)
-    @Transactional(rollbackFor = Exception.class)
-    public void processss(Message message, Channel channel) throws IOException {
-        try {
-            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        String content = new String(message.getBody());
-        try {
-            NorthMsgId northMsgId = JSON.parseObject(content, NorthMsgId.class);
-            northMsgIdService.saveOrUpdate(northMsgId);
-        } catch (Exception e) {
-            log.error("消费失败原因:主键重复");
-        }
-    }
-
-}