This commit is contained in:
linfso 2024-05-09 13:48:05 +08:00
parent fdbc10dcb9
commit 272a8b4c65
2 changed files with 10 additions and 35 deletions

View File

@ -90,7 +90,7 @@ public class EmisDestinationController extends BaseController
{ {
// lineCode, // lineCode,
if(StringUtils.isAnyEmpty(province)){ if(StringUtils.isAnyEmpty(province)){
return AjaxResult.error("参数错误,线路和省份不能为空!"); return AjaxResult.error("参数错误,省份不能为空!");
} }
EmisDestination dest = emisDestinationService.calcDestSite(country,lineCode,province,city,county,address); EmisDestination dest = emisDestinationService.calcDestSite(country,lineCode,province,city,county,address);

View File

@ -73,39 +73,21 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
@Override @Override
public EmisDestination calcDestSite(String country,String lineCode, String province, String city, String county, String address) { public EmisDestination calcDestSite(String country,String lineCode, String province, String city, String county, String address) {
// 如果省份不存在,则取目的国的地一个字段 // 目前只根据目的省份获取目的地
// 获取 areaId // 获取 areaId
Long areaId = null; Long areaId = null;
EmisRegion queryEmisRegion = new EmisRegion(); EmisRegion queryEmisRegion = new EmisRegion();
queryEmisRegion.setRegionCode(province); queryEmisRegion.setRegionCode(province);
List<EmisRegion> regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion); List<EmisRegion> regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
if(CollectionUtil.isEmpty(regionList)){
// 如果身份按国家获取第一个区域
queryEmisRegion = new EmisRegion();
// 按省份获取区域
queryEmisRegion.setRegionType(1);
queryEmisRegion.setCountryCode(country);
regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
if(!CollectionUtil.isEmpty(regionList)){ if(!CollectionUtil.isEmpty(regionList)){
for (EmisRegion emisRegion:regionList) { areaId = regionList.get(0).getAreaId();
if(emisRegion.getAreaId()!=null){ country = regionList.get(0).getCountryCode();
areaId = emisRegion.getAreaId();
break;
}
}
} // 根据大区获取目的网点
} EmisDestination queryEmisDestination = new EmisDestination();
EmisDestination queryEmisDestination=null;
List<EmisDestination> destinationList=null;
if(areaId != null && areaId> 0 ){
// 查询目的地,优先根据区域查询,如果查询不到则按线路查询
queryEmisDestination = new EmisDestination();
// queryEmisDestination.setLineCode(lineCode);
queryEmisDestination.setCountryAreaId(areaId); queryEmisDestination.setCountryAreaId(areaId);
destinationList=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination); List<EmisDestination> destinationList=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
if(!CollectionUtil.isEmpty(destinationList)){ if(!CollectionUtil.isEmpty(destinationList)){
return destinationList.get(0); return destinationList.get(0);
} }
@ -119,16 +101,9 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
} }
} }
}else{
// 根据国家查询
queryEmisDestination = new EmisDestination();
queryEmisDestination.setCountry(country);
destinationList=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
if(!CollectionUtil.isEmpty(destinationList)){
return destinationList.get(0);
}
} }
return null; return null;
} }