|
@@ -227,6 +227,20 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
if (berthingPointConfig == null) {
|
|
|
//新增
|
|
|
berthingPointConfig = new BerthingPointConfig();
|
|
|
+ //先查询有无重复添加
|
|
|
+ berthingPointConfig.setWlevel(berthingPointConfigDTO.getWlevel());
|
|
|
+ berthingPointConfig.setSiteId(berthingPointConfigDTO.getSiteId());
|
|
|
+ long count = berthingPointConfigMapper.count(berthingPointConfig);
|
|
|
+ if (count > 0){
|
|
|
+ throw new BaseException("起测水位已存在");
|
|
|
+ }
|
|
|
+ //有无重复策略号
|
|
|
+ berthingPointConfig.setPlanid(berthingPointConfigDTO.getPlanid());
|
|
|
+ berthingPointConfig.setWlevel(null);
|
|
|
+ count = berthingPointConfigMapper.count(berthingPointConfig);
|
|
|
+ if (count > 0){
|
|
|
+ throw new BaseException("策略编号已存在");
|
|
|
+ }
|
|
|
berthingPointConfig.setStopId(0L);
|
|
|
berthingPointConfig.setSiteId(siteInfo.getSiteId());
|
|
|
berthingPointConfig.setBerthingId(0L);
|
|
@@ -258,6 +272,8 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
String data = JSONUtil.toJsonStr(requestMap);
|
|
|
log.info("mqtt发送数据:topic:{} data:{}",topic,data);
|
|
|
mqttGateWayService.sendMessageToMqtt(data, topic);
|
|
|
+ } catch (BaseException e){
|
|
|
+ throw new BaseException(e.getMessage());
|
|
|
} catch (Exception e){
|
|
|
log.error("新增或修改停泊点错误", e);
|
|
|
throw new BaseException("新增或修改停泊点错误");
|
|
@@ -313,8 +329,16 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
if (count > 0){
|
|
|
throw new BaseException("起测水位已存在");
|
|
|
}
|
|
|
+ //有无重复策略号
|
|
|
+ berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
+ berthingTime.setWlevel(null);
|
|
|
+ count = berthingTimeConfigMapper.count(berthingTime);
|
|
|
+ if (count > 0){
|
|
|
+ throw new BaseException("策略编号已存在");
|
|
|
+ }
|
|
|
//新增
|
|
|
berthingTime.setTimeId(0L);
|
|
|
+ berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
berthingTime.setCreateTime(new Date());
|
|
@@ -386,7 +410,7 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
if (berthingFloatDTO.getFloatId() == null) {
|
|
|
berthingFloatDTO.setFloatId(0L);
|
|
|
}
|
|
|
- boolean res = false;
|
|
|
+ boolean res;
|
|
|
BerthingFloatConfig berthingFloat = berthingFloatConfigMapper.queryById(berthingFloatDTO.getFloatId());
|
|
|
try {
|
|
|
if (berthingFloat == null) {
|
|
@@ -398,8 +422,16 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
if (count > 0) {
|
|
|
throw new BaseException("起浮水位已存在");
|
|
|
}
|
|
|
+ //有无重复策略号
|
|
|
+ berthingFloat.setPlanid(berthingFloatDTO.getPlanid());
|
|
|
+ berthingFloat.setWlevel(null);
|
|
|
+ count = berthingFloatConfigMapper.count(berthingFloat);
|
|
|
+ if (count > 0){
|
|
|
+ throw new BaseException("策略编号已存在");
|
|
|
+ }
|
|
|
berthingFloat.setFloatId(0L);
|
|
|
berthingFloat.setPlanid(berthingFloatDTO.getPlanid());
|
|
|
+ berthingFloat.setWlevel(berthingFloatDTO.getWlevel());
|
|
|
berthingFloat.setCreateTime(new Date());
|
|
|
berthingFloat.setIsDel(0);
|
|
|
berthingFloat.setStatus(1);
|