From c0362996a86bb937db47faf8a455a4e3fc13b40f Mon Sep 17 00:00:00 2001 From: linfso Date: Mon, 15 Jul 2024 11:02:20 +0800 Subject: [PATCH] md --- .../oms/web/Oms2cDestinationController.java | 34 +--- .../oms/service/IEmisDestinationService.java | 21 --- .../impl/EmisDestinationServiceImpl.java | 146 ------------------ .../oms/service/svc/IRpcDestinationSvc.java | 44 ++++++ 4 files changed, 50 insertions(+), 195 deletions(-) create mode 100644 emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/svc/IRpcDestinationSvc.java diff --git a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cDestinationController.java b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cDestinationController.java index ef734e2..a89bccc 100644 --- a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cDestinationController.java +++ b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cDestinationController.java @@ -19,6 +19,7 @@ import com.xdadan.erp.oms.common.core.page.TableDataInfo; import com.xdadan.erp.oms.common.enums.BusinessType; import com.xdadan.erp.oms.domain.EmisDestination; import com.xdadan.erp.oms.service.IEmisDestinationService; +import com.xdadan.erp.oms.service.svc.IRpcDestinationSvc; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -40,6 +41,9 @@ public class Oms2cDestinationController extends BaseController @Autowired private IEmisDestinationService emisDestinationService; + @Autowired + IRpcDestinationSvc iRpcDestinationSvc; + /** * 查询目的地列表 */ @@ -64,30 +68,15 @@ public class Oms2cDestinationController extends BaseController return getDataTable(list); } - /** * 根据客户信息获取目的地站点 * @param province * @return */ @GetMapping("/getDestSite") - @JacksonFilter(include= { - "id","destCode","destName","destNameEn", - "lineCode","lineName","countryName","country","siteCode","siteName", - },value= EmisDestination.class,type= JacksonFilter.JscksonFilterType.RESPONSE) public AjaxResult getDestSite(String country, String lineCode, String province, String city, String county, String address) { - if(StringUtils.isAnyEmpty(province)){ - return AjaxResult.error("参数错误,省份不能为空!"); - } - - EmisDestination dest = emisDestinationService.calcDestSite(country,lineCode,province,city,county,address); - if(dest==null){ - return AjaxResult.error("联系客户,收件地不在服务范围!"); - }else{ - return AjaxResult.success("获取成功",dest); - } - + return iRpcDestinationSvc.getDestSite(country,lineCode,province,city,county,address); } /** @@ -96,20 +85,9 @@ public class Oms2cDestinationController extends BaseController * @return */ @GetMapping("/getSendSite") - @JacksonFilter(include= {"siteCode","siteName", - },value= EmisDestination.class,type= JacksonFilter.JscksonFilterType.RESPONSE) public AjaxResult getSendSite(String country, String lineCode, String province, String city, String county, String address) { - if(StringUtils.isAnyEmpty(province)){ - return AjaxResult.error("参数错误,省份不能为空!"); - } - EmisDestination dest = emisDestinationService.calcSendSite(country,lineCode,province,city,county,address); - if(dest==null){ - return AjaxResult.error("联系客户,收件地不在服务范围!"); - }else{ - return AjaxResult.success("获取成功",dest); - } - + return iRpcDestinationSvc.getSendSite(country,lineCode,province,city,county,address); } diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisDestinationService.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisDestinationService.java index 67fbb81..2542763 100644 --- a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisDestinationService.java +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisDestinationService.java @@ -20,12 +20,6 @@ import com.xdadan.erp.oms.domain.EmisDestination; */ public interface IEmisDestinationService { - /** - * 主键查询 - * @param id - * @return - */ - public EmisDestination selectEmisDestinationById(Long id); /** * 查询目的地列表 @@ -36,19 +30,4 @@ public interface IEmisDestinationService public List selectEmisDestinationList(EmisDestination emisDestination); - /** - * 根据收件信息获取目的地 - * @param lineCode - * @param province - * @param city - * @param county - * @param address - * @return - */ - public EmisDestination calcDestSite(String country,String lineCode,String province,String city,String county,String address); - - public EmisDestination calcSendSite(String country,String lineCode, String province, String city, String county, String address); - - - } diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisDestinationServiceImpl.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisDestinationServiceImpl.java index be1fa1d..a203882 100644 --- a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisDestinationServiceImpl.java +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisDestinationServiceImpl.java @@ -37,23 +37,6 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService @Autowired private EmisDestinationMapper emisDestinationMapper; - @Autowired - private EmisRegionMapper emisRegionMapper; - - @Autowired - private EmisCountryAreaMapper emisCountryAreaMapper; - - /** - * 查询目的地 - * - * @param id 目的地主键 - * @return 目的地 - */ - @Override - public EmisDestination selectEmisDestinationById(Long id) - { - return emisDestinationMapper.selectEmisDestinationById(id); - } /** * 查询目的地列表 @@ -68,134 +51,5 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService } - public EmisRegion getRegionByCode(String code){ - - EmisRegion queryRegion = new EmisRegion(); - queryRegion.setRegionCode(code); - - List list=emisRegionMapper.selectEmisRegionList(queryRegion); - if(!CollectionUtils.isEmpty(list)){ - return list.get(0); - } - - return null; - - } - - /** - * 计算目的地 - * @param country - * @param lineCode - * @param province - * @param city - * @param county - * @param address - * @return - */ - public EmisDestination calcDestSite(String country,String lineCode, String province, String city, String county, String address) { - - EmisDestination destination=null; - // 获取 areaId - Long areaId = null; - - // 根据区获取目的地 - if(!StringUtils.isEmpty(county)) { - EmisRegion regionCounty = getRegionByCode(county); - if (regionCounty != null) { - areaId = regionCounty.getAreaId(); - } - } - - - // 根据城市获取目的地 - if( (areaId==null || areaId==0) && !StringUtils.isEmpty(city)) { - EmisRegion regionCity = getRegionByCode(city); - if (regionCity != null) { - areaId = regionCity.getAreaId(); - } - } - - // 根据省获取目的地 - if((areaId==null || areaId==0) && !StringUtils.isEmpty(province)){ - EmisRegion regionProvice= getRegionByCode(province); - if(regionProvice!=null){ - areaId=regionProvice.getAreaId(); - } - } - - // 根据大区获取目的网点 - if(areaId!=null && areaId>0) { - EmisDestination queryEmisDestination = new EmisDestination(); - queryEmisDestination.setCountryAreaId(areaId); - queryEmisDestination.setStatus(1); - List destinationList = emisDestinationMapper.selectEmisDestinationList(queryEmisDestination); - if (!CollectionUtil.isEmpty(destinationList)) { - destination=destinationList.get(0); - } - } - - return destination; - - - } - - - /** - * 计算寄件网点 - * @param lineCode - * @param province - * @param city - * @param county - * @param address - * @return - */ - @Override - public EmisDestination calcSendSite(String country,String lineCode, String province, String city, String county, String address) { - - - EmisDestination destination=null; - // 获取 areaId - Long areaId = null; - - // 根据区获取目的地 - if(!StringUtils.isEmpty(county)) { - EmisRegion regionCounty = getRegionByCode(county); - if (regionCounty != null) { - areaId = regionCounty.getAreaId(); - } - } - - - // 根据城市获取目的地 - if( (areaId==null || areaId==0) && !StringUtils.isEmpty(city)) { - EmisRegion regionCity = getRegionByCode(city); - if (regionCity != null) { - areaId = regionCity.getAreaId(); - } - } - - // 根据省获取目的地 - if((areaId==null || areaId==0) && !StringUtils.isEmpty(province)){ - EmisRegion regionProvice= getRegionByCode(province); - if(regionProvice!=null){ - areaId=regionProvice.getAreaId(); - } - } - - // 根据大区获取服务网点 - if(areaId!=null && areaId>0) { - EmisCountryArea emisCountryArea =emisCountryAreaMapper.selectEmisCountryAreaById(areaId); - if(emisCountryArea!=null){ - destination = new EmisDestination(); - destination.setSiteCode(emisCountryArea.getSiteCode()); - destination.setSiteName(emisCountryArea.getSiteName()); - } - - } - - return destination; - - } - } diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/svc/IRpcDestinationSvc.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/svc/IRpcDestinationSvc.java new file mode 100644 index 0000000..2e89a6e --- /dev/null +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/svc/IRpcDestinationSvc.java @@ -0,0 +1,44 @@ +package com.xdadan.erp.oms.service.svc; + + +import com.xdadan.erp.oms.common.core.domain.AjaxResult; +import com.xdadan.erp.oms.domain.vo.WaybillOrder; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient(name = "IRpcDestinationSvc",url = "${service.provider.url}",configuration = {FeignErrorDecoder.class}) +public interface IRpcDestinationSvc { + + + /** + * 获取目的地 + * @param + * @return + */ + @PostMapping(value = "/apiweb/emisDestination/getDestSite") + public AjaxResult getDestSite(@RequestParam("country")String country, + @RequestParam("lineCode")String lineCode, + @RequestParam("province")String province, + @RequestParam("city")String city, + @RequestParam("county")String county, + @RequestParam("address")String address); + + + + /** + * 获取寄件地 + * @param + * @return + */ + @PostMapping(value = "/apiweb/emisDestination/getSendSite") + public AjaxResult getSendSite(@RequestParam("country")String country, + @RequestParam("lineCode")String lineCode, + @RequestParam("province")String province, + @RequestParam("city")String city, + @RequestParam("county")String county, + @RequestParam("address")String address); + + +} \ No newline at end of file