|
@@ -307,8 +307,22 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
|
|
|
@Override
|
|
|
public Boolean deleteStopPointsById(Long id) {
|
|
|
- berthingPointConfigMapper.deleteById(id);
|
|
|
- return true;
|
|
|
+ BerthingPointConfig berthingPointConfig = berthingPointConfigMapper.queryById(id);
|
|
|
+ boolean res = berthingPointConfigMapper.deleteById(id) > 0;
|
|
|
+ if (berthingPointConfig != null) {
|
|
|
+ SiteInfo siteInfo = siteInfoMapper.queryById(berthingPointConfig.getSiteId());
|
|
|
+ //TODO 下发配置
|
|
|
+ String topic = "down/" + siteInfo.getDeviceId() + "/removePlan";
|
|
|
+ HashMap<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", siteInfo.getId());
|
|
|
+ requestMap.put("type",0);
|
|
|
+ requestMap.put("planid", berthingPointConfig.getPlanid());
|
|
|
+ requestMap.put("plantype", 0); //策略类型,0: 垂线停泊点;1: 时间计划;2: 水位变幅
|
|
|
+ String data = JSONUtil.toJsonStr(requestMap);
|
|
|
+ log.info("mqtt发送数据:topic:{} data:{}", topic, data);
|
|
|
+ mqttGateWayService.sendMessageToMqtt(data, topic);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -398,8 +412,22 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
|
|
|
@Override
|
|
|
public boolean deleteStopTimeById(Long id) {
|
|
|
- berthingTimeConfigMapper.deleteById(id);
|
|
|
- return true;
|
|
|
+ BerthingTimeConfig berthingTimeConfig = berthingTimeConfigMapper.queryById(id);
|
|
|
+ boolean res = berthingTimeConfigMapper.deleteById(id) > 0;
|
|
|
+ if (berthingTimeConfig != null) {
|
|
|
+ SiteInfo siteInfo = siteInfoMapper.queryById(berthingTimeConfig.getSiteId());
|
|
|
+ //TODO 下发配置
|
|
|
+ String topic = "down/" + siteInfo.getDeviceId() + "/removePlan";
|
|
|
+ HashMap<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", siteInfo.getId());
|
|
|
+ requestMap.put("type", berthingTimeConfig.getType());
|
|
|
+ requestMap.put("planid", berthingTimeConfig.getPlanid());
|
|
|
+ requestMap.put("plantype", 1); //策略类型,0: 垂线停泊点;1: 时间计划;2: 水位变幅
|
|
|
+ String data = JSONUtil.toJsonStr(requestMap);
|
|
|
+ log.info("mqtt发送数据:topic:{} data:{}", topic, data);
|
|
|
+ mqttGateWayService.sendMessageToMqtt(data, topic);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -490,8 +518,22 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
|
|
|
@Override
|
|
|
public boolean deleteStopWaterById(Long id) {
|
|
|
- berthingFloatConfigMapper.deleteById(id);
|
|
|
- return true;
|
|
|
+ BerthingFloatConfig berthingFloat = berthingFloatConfigMapper.queryById(id);
|
|
|
+ boolean res = berthingFloatConfigMapper.deleteById(id) > 0;
|
|
|
+ if (berthingFloat != null) {
|
|
|
+ SiteInfo siteInfo = siteInfoMapper.queryById(berthingFloat.getSiteId());
|
|
|
+ //TODO 下发配置
|
|
|
+ String topic = "down/" + siteInfo.getDeviceId() + "/removePlan";
|
|
|
+ HashMap<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("id", siteInfo.getId());
|
|
|
+ requestMap.put("type", berthingFloat.getType());
|
|
|
+ requestMap.put("planid", berthingFloat.getPlanid());
|
|
|
+ requestMap.put("plantype", 2); //策略类型,0: 垂线停泊点;1: 时间计划;2: 水位变幅
|
|
|
+ String data = JSONUtil.toJsonStr(requestMap);
|
|
|
+ log.info("mqtt发送数据:topic:{} data:{}", topic, data);
|
|
|
+ mqttGateWayService.sendMessageToMqtt(data, topic);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
}
|