Commit b5cff5a5 authored by KeYong's avatar KeYong

更新

parent aea6e9f5
......@@ -31,6 +31,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
......@@ -131,6 +132,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
@Override
@Transactional(rollbackFor = Exception.class)
public void confirmAlam(EquipmentSpecificAlarmLog ent, String appKey, String product, String token, String userId) {
try {
AgencyUserModel userModel = remoteSecurityService.getAgencyUser();
......@@ -184,14 +186,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
//数字换流站使用
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), "");
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
// mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
// }
// });
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
}
});
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("确认失败");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment