|
@@ -305,13 +305,18 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
try {
|
|
|
ArrayList<String> times = berthingTimeDTO.getTimes();
|
|
|
if (berthingTime == null) {
|
|
|
- //新增
|
|
|
berthingTime = new BerthingTimeConfig();
|
|
|
- berthingTime.setTimeId(0L);
|
|
|
+ //先查询有无重复添加
|
|
|
+ berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
berthingTime.setSiteId(siteInfo.getSiteId());
|
|
|
+ long count = berthingTimeConfigMapper.count(berthingTime);
|
|
|
+ if (count > 0){
|
|
|
+ throw new BaseException("起测水位已存在");
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ berthingTime.setTimeId(0L);
|
|
|
berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
- berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
berthingTime.setCreateTime(new Date());
|
|
|
berthingTime.setIsDel(0);
|
|
|
berthingTime.setStatus(1);
|
|
@@ -337,6 +342,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("新增或修改时间策略错误");
|