Commit a4f032a3 authored by tangwei's avatar tangwei

修改bug

parent e89864e9
...@@ -10,6 +10,6 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex; ...@@ -10,6 +10,6 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
public interface IPointSystemService { public interface IPointSystemService {
//触发风险预警 //触发风险预警
public void sendWarning(String address, String value); public void sendWarning(String address, String value,String valueLabe);
} }
...@@ -45,7 +45,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point ...@@ -45,7 +45,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
protected EmqKeeper emqKeeper; protected EmqKeeper emqKeeper;
@Override @Override
public void sendWarning(String address, String value) { public void sendWarning(String address, String value,String valueLabe) {
try { try {
//通过测点地址获取,和对应值 获取kks //通过测点地址获取,和对应值 获取kks
QueryWrapper<PointSystem> pointSystemWrapper = new QueryWrapper<>(); QueryWrapper<PointSystem> pointSystemWrapper = new QueryWrapper<>();
...@@ -74,8 +74,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point ...@@ -74,8 +74,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
eqdata = (JSONObject) list.get(0); eqdata = (JSONObject) list.get(0);
//组装数据,发送预警 //组装数据,发送预警
WarningDto warningDto = setWarningDto(pointSystem, eqdata); WarningDto warningDto = setWarningDto(pointSystem, eqdata, valueLabe);
emqKeeper.getMqttClient().publish(STATIONWARNING, JSON.toJSONString(warningDto).getBytes(), 0, false); emqKeeper.getMqttClient().publish(STATIONWARNING, JSON.toJSONString(warningDto).getBytes(), 0, false);
} catch (Exception e) { } catch (Exception e) {
...@@ -85,28 +84,27 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point ...@@ -85,28 +84,27 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
} }
public WarningDto setWarningDto(PointSystem pointSystem,JSONObject eqdata ){ public WarningDto setWarningDto(PointSystem pointSystem,JSONObject eqdata,String valueLabe ){
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time= sdf.format(new Date()); String time= sdf.format(new Date());
String warningObjectCode=pointSystem.getKks(); String warningObjectCode=pointSystem.getKks();
List<TabContent> tabContent=new ArrayList<>(); List<TabContent> tabContent=new ArrayList<>();
tabContent.add(new TabContent( "KKS编码", TEXT, warningObjectCode, "key1")); tabContent.add(new TabContent( "KKS编码", TEXT, warningObjectCode, "key1"));
tabContent.add(new TabContent( "设备名称", TEXT, eqdata.get("kksms"), "key2")); tabContent.add(new TabContent( "设备名称", TEXT, eqdata.get("kksms"), "key2"));
tabContent.add(new TabContent( "发生时间", TEXT, time, "key3")); tabContent.add(new TabContent( "告警原因", TEXT, valueLabe, "key3"));
tabContent.add(new TabContent( "发生时间", TEXT, time, "key4"));
DynamicDetails dynamicDetails=new DynamicDetails( TABNAME, tabContent); DynamicDetails dynamicDetails=new DynamicDetails( TABNAME, tabContent);
List<DynamicDetails> dynamicDetailsList=new ArrayList<>(); List<DynamicDetails> dynamicDetailsList=new ArrayList<>();
dynamicDetailsList.add(dynamicDetails); dynamicDetailsList.add(dynamicDetails);
StringBuffer indexKey=new StringBuffer(pointSystem.getStation()) StringBuilder indexKey=new StringBuilder(pointSystem.getStation())
.append("#") .append("#")
.append(pointSystem.getNumber()) .append(pointSystem.getNumber())
.append("#") .append("#")
.append(pointSystem.getFunctionNum()); .append(pointSystem.getFunctionNum());
StringBuffer indexValue=new StringBuffer(pointSystem.getPointType()) String indexValue=valueLabe;
.append("#")
.append(pointSystem.getValue());
WarningDto WarningDto=new WarningDto( WarningDto WarningDto=new WarningDto(
indexKey.toString(), indexKey.toString(),
indexValue.toString(), indexValue,
null, null,
(String)eqdata.get("sourceAttributionDesc"), (String)eqdata.get("sourceAttributionDesc"),
(String)eqdata.get("sourceAttribution"), (String)eqdata.get("sourceAttribution"),
......
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