|
|
@@ -57,11 +57,16 @@ public class KwmLineFreightRateService {
|
|
|
if (count > 0) {
|
|
|
throw new BusinessException("路径名称已存在,不可重复!");
|
|
|
}
|
|
|
- KwmAddress load = addressService.getByNameAndEntId(addLineFreightRateParam.getLoadName(), entId);
|
|
|
+ String loadName = addLineFreightRateParam.getLoadName();
|
|
|
+ String unloadName = addLineFreightRateParam.getUnloadName();
|
|
|
+ if (Objects.equals(loadName,unloadName)){
|
|
|
+ throw new BusinessException("路径起始结束位置不能相同!");
|
|
|
+ }
|
|
|
+ KwmAddress load = addressService.getByNameAndEntId(loadName, entId);
|
|
|
if (Objects.isNull(load)) {
|
|
|
throw new BusinessException("路径起始位置信息不存在!");
|
|
|
}
|
|
|
- KwmAddress unload = addressService.getByNameAndEntId(addLineFreightRateParam.getUnloadName(), entId);
|
|
|
+ KwmAddress unload = addressService.getByNameAndEntId(unloadName, entId);
|
|
|
if (Objects.isNull(unload)) {
|
|
|
throw new BusinessException("路径结束位置信息不存在!");
|
|
|
}
|
|
|
@@ -94,6 +99,10 @@ public class KwmLineFreightRateService {
|
|
|
}
|
|
|
KwmLineFreightRate freightRate = BeanUtil.copyProperties(param, KwmLineFreightRate.class);
|
|
|
String loadName = param.getLoadName();
|
|
|
+ String unloadName = param.getUnloadName();
|
|
|
+ if (Objects.equals(loadName,unloadName)){
|
|
|
+ throw new BusinessException("路径起始结束位置不能相同!");
|
|
|
+ }
|
|
|
if (!Objects.equals(loadName, lineFreightRate.getLoadName())) {
|
|
|
KwmAddress load = addressService.getByNameAndEntId(param.getLoadName(), entId);
|
|
|
if (Objects.isNull(load)) {
|
|
|
@@ -103,7 +112,6 @@ public class KwmLineFreightRateService {
|
|
|
.setLoadCityName(load.getCityName()).setLoadDetailAddress(load.getDetailAddress())
|
|
|
.setLoadLng(load.getLng()).setLoadLat(load.getLat());
|
|
|
}
|
|
|
- String unloadName = param.getUnloadName();
|
|
|
if (!Objects.equals(unloadName, lineFreightRate.getUnloadName())) {
|
|
|
KwmAddress unload = addressService.getByNameAndEntId(param.getUnloadName(), entId);
|
|
|
if (Objects.isNull(unload)) {
|