|
@@ -241,7 +241,7 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
BerthingPointConfig maxPlanid = berthingPointConfigMapper.queryMaxPlanid(berthingPointConfigDTO.getSiteId());
|
|
|
if (maxPlanid == null) {
|
|
|
maxPlanid = new BerthingPointConfig();
|
|
|
- maxPlanid.setPlanid(1L);
|
|
|
+ maxPlanid.setPlanid(0L);
|
|
|
}
|
|
|
berthingPointConfig.setStopId(0L);
|
|
|
berthingPointConfig.setSiteId(siteInfo.getSiteId());
|
|
@@ -333,17 +333,15 @@ 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("策略编号已存在");
|
|
|
+ BerthingFloatConfig maxPlanidTimeConfig = berthingTimeConfigMapper.queryByMaxPlanid(siteInfo.getSiteId());
|
|
|
+ if (maxPlanidTimeConfig == null) {
|
|
|
+ berthingTime.setPlanid(1L);
|
|
|
+ } else {
|
|
|
+ berthingTime.setPlanid(maxPlanidTimeConfig.getPlanid() + 1);
|
|
|
}
|
|
|
//新增
|
|
|
berthingTime.setTimeId(0L);
|
|
|
berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
- berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
berthingTime.setCreateTime(new Date());
|
|
|
berthingTime.setIsDel(0);
|
|
@@ -353,7 +351,6 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
res = berthingTimeConfigMapper.insert(berthingTime) > 0;
|
|
|
} else {
|
|
|
//更新
|
|
|
- berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
berthingTime.setType(berthingTimeDTO.getType());
|
|
@@ -426,15 +423,13 @@ 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("策略编号已存在");
|
|
|
+ BerthingFloatConfig maxPlanidFloatConfig = berthingFloatConfigMapper.queryByMaxPlanid(siteInfo.getSiteId());
|
|
|
+ if (maxPlanidFloatConfig == null) {
|
|
|
+ berthingFloat.setPlanid(1L);
|
|
|
+ } else {
|
|
|
+ berthingFloat.setPlanid(maxPlanidFloatConfig.getPlanid() + 1);
|
|
|
}
|
|
|
berthingFloat.setFloatId(0L);
|
|
|
- berthingFloat.setPlanid(berthingFloatDTO.getPlanid());
|
|
|
berthingFloat.setWlevel(berthingFloatDTO.getWlevel());
|
|
|
berthingFloat.setCreateTime(new Date());
|
|
|
berthingFloat.setIsDel(0);
|
|
@@ -447,7 +442,6 @@ public class BerthingServiceImpl implements BerthingService {
|
|
|
} else {
|
|
|
//更新
|
|
|
berthingFloat.setType(berthingFloatDTO.getType());
|
|
|
- berthingFloat.setPlanid(berthingFloatDTO.getPlanid());
|
|
|
berthingFloat.setWlevel(berthingFloatDTO.getWlevel());
|
|
|
berthingFloat.setTimespan(berthingFloatDTO.getTimespan());
|
|
|
berthingFloat.setWlevelchange(berthingFloatDTO.getWlevelchange());
|