diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQConsume.java b/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQConsume.java index 03645e0c..81f79d18 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQConsume.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQConsume.java @@ -37,7 +37,7 @@ public class ResourceMQConsume { public void resourceStatusProcess(String text, MessageHeaders headers) { logger.info("接收设备状态变更数据:" + text); - String resultString = resourceMQProcess.resourceStatusProcess(text); + resourceMQProcess.resourceStatusProcess(text); //返回设备处理结果 // template.convertAndSend((Queue) headers.get("jms_replyTo"), resultString); } @@ -45,7 +45,7 @@ public class ResourceMQConsume { @JmsListener(destination = "resource.alarm.process", containerFactory = "defaultFactory") public void resourceAlarmProcess(String text, MessageHeaders headers) { logger.info("接收设备报警数据:" + text); - String resultString = resourceMQProcess.resourceFaultProcess(text); + resourceMQProcess.resourceFaultProcess(text); // template.convertAndSend((Queue) headers.get("jms_replyTo"), resultString); } diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQProcess.java b/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQProcess.java index e40dd617..b1f1d4ae 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQProcess.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/consumer/ResourceMQProcess.java @@ -1,10 +1,11 @@ package com.foreverwin.mesnac.equip.consumer; -import com.alibaba.fastjson.JSONObject; -import com.foreverwin.mesnac.equip.dto.MQResponseDto; + import com.foreverwin.mesnac.equip.service.EdcDataResourceService; import com.foreverwin.mesnac.equip.service.ResourceFaultReceiveService; import com.foreverwin.mesnac.equip.service.ResourceStatusReceiveService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,6 +20,8 @@ import org.springframework.stereotype.Component; @Component public class ResourceMQProcess { + private static Logger logger = LoggerFactory.getLogger(ResourceMQProcess.class); + @Autowired private ResourceStatusReceiveService resourceStatusReceiveService; @@ -34,18 +37,13 @@ public class ResourceMQProcess { * @param text * @return */ - public String resourceStatusProcess(String text) { - MQResponseDto mqResponseDto = new MQResponseDto(); + public void resourceStatusProcess(String text) { try { - String handle = resourceStatusReceiveService.updateResourceStatusByMq(text); - mqResponseDto.setHANDLE(handle); - mqResponseDto.setSTATUS("Success"); - mqResponseDto.setMESSAGE("设备状态修改成功!"); + resourceStatusReceiveService.updateResourceStatusByMq(text); + logger.info("设备状态修改成功!"); } catch (Exception e) { - mqResponseDto.setSTATUS("Error"); - mqResponseDto.setMESSAGE("设备状态修改失败:" + e.getMessage()); + logger.error("设备状态修改失败:" + e.getMessage()); } - return JSONObject.toJSONString(mqResponseDto); } /** @@ -53,36 +51,26 @@ public class ResourceMQProcess { * @param text * @return */ - public String resourceFaultProcess(String text){ - MQResponseDto mqResponseDto = new MQResponseDto(); + public void resourceFaultProcess(String text){ try { - String handle = resourceFaultReceiveService.parseResourceFaultInfo(text); - mqResponseDto.setHANDLE(handle); - mqResponseDto.setSTATUS("Success"); - mqResponseDto.setMESSAGE("设备状态修改成功!"); + resourceFaultReceiveService.parseResourceFaultInfo(text); + logger.info("设备故障信息记录成功!"); } catch (Exception e) { - mqResponseDto.setSTATUS("Error"); - mqResponseDto.setMESSAGE("设备状态修改失败:" + e.getMessage()); + logger.error("设备故障信息记录失败:" + e.getMessage()); } - return JSONObject.toJSONString(mqResponseDto); } /** * 设备参数信息记录 * @param text * @return */ - public String resourceParamProcess(String text){ - MQResponseDto mqResponseDto = new MQResponseDto(); + public void resourceParamProcess(String text){ try { - String handle = edcDataResourceService.saveResourceParamByMq(text); - mqResponseDto.setHANDLE(handle); - mqResponseDto.setSTATUS("Success"); - mqResponseDto.setMESSAGE("设备状态修改成功!"); + edcDataResourceService.saveResourceParamByMq(text); + logger.info("设备参数信息记录成功"); } catch (Exception e) { - mqResponseDto.setSTATUS("Error"); - mqResponseDto.setMESSAGE("设备状态修改失败:" + e.getMessage()); + logger.error("设备参数信息记录失败:"+e.getMessage()); } - return JSONObject.toJSONString(mqResponseDto); } } diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/service/EdcDataResourceService.java b/equip/src/main/java/com/foreverwin/mesnac/equip/service/EdcDataResourceService.java index 409a470a..d036510b 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/service/EdcDataResourceService.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/service/EdcDataResourceService.java @@ -31,6 +31,6 @@ public interface EdcDataResourceService extends IService { * @param text * @return */ - String saveResourceParamByMq(String text); + void saveResourceParamByMq(String text); } \ No newline at end of file diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceFaultReceiveService.java b/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceFaultReceiveService.java index 342215de..7a9c2228 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceFaultReceiveService.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceFaultReceiveService.java @@ -26,7 +26,7 @@ public interface ResourceFaultReceiveService extends IService selectList(ResourceFaultReceive resourceFaultReceive); - String parseResourceFaultInfo(String text); + void parseResourceFaultInfo(String text); } \ No newline at end of file diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceStatusReceiveService.java b/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceStatusReceiveService.java index 3fa82154..0ba0b382 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceStatusReceiveService.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/service/ResourceStatusReceiveService.java @@ -27,10 +27,10 @@ public interface ResourceStatusReceiveService extends IService selectList(ResourceStatusReceive resourceStatusReceive); /** - * 插入新数据、更新数据、更新设备状态 + * 更新设备状态接收记录 * @param text */ - String updateResourceStatusByMq(String text); + void updateResourceStatusByMq(String text); } \ No newline at end of file diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/EdcDataResourceServiceImpl.java b/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/EdcDataResourceServiceImpl.java index 2ca69f6a..217c04ee 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/EdcDataResourceServiceImpl.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/EdcDataResourceServiceImpl.java @@ -17,8 +17,6 @@ import com.foreverwin.mesnac.equip.model.EdcDataResource; import com.foreverwin.mesnac.equip.mapper.EdcDataResourceMapper; import com.foreverwin.mesnac.equip.service.EdcDataResourceService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -41,8 +39,6 @@ import java.util.UUID; @Transactional(rollbackFor = Exception.class) public class EdcDataResourceServiceImpl extends ServiceImpl implements EdcDataResourceService { - private static Logger logger = LoggerFactory.getLogger(EdcDataResourceServiceImpl.class); - @Autowired private EdcDataResourceMapper edcDataResourceMapper; @Autowired @@ -65,7 +61,7 @@ public class EdcDataResourceServiceImpl extends ServiceImpl getParamList = dcParameterMapper.getDcParameterByDcGroupBo(dcGroupBo); if (getParamList.size() < 1){ - logger.info("数据收集组" + dcGroupBo + "未维护字段信息"); throw BusinessException.build("数据收集组" + dcGroupBo + "未维护字段信息"); } for (DcParameter dcParam:getParamList) { @@ -156,7 +146,6 @@ public class EdcDataResourceServiceImpl extends ServiceImpl implements ResourceFaultReceiveService { - private static Logger logger = LoggerFactory.getLogger(ResourceFaultReceiveServiceImpl.class); @Autowired private ResourceFaultReceiveService resourceFaultReceiveService; @@ -62,7 +59,7 @@ public class ResourceFaultReceiveServiceImpl extends ServiceImpl