md
This commit is contained in:
parent
aa4143f6fe
commit
c0362996a8
@ -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.common.enums.BusinessType;
|
||||||
import com.xdadan.erp.oms.domain.EmisDestination;
|
import com.xdadan.erp.oms.domain.EmisDestination;
|
||||||
import com.xdadan.erp.oms.service.IEmisDestinationService;
|
import com.xdadan.erp.oms.service.IEmisDestinationService;
|
||||||
|
import com.xdadan.erp.oms.service.svc.IRpcDestinationSvc;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -40,6 +41,9 @@ public class Oms2cDestinationController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IEmisDestinationService emisDestinationService;
|
private IEmisDestinationService emisDestinationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IRpcDestinationSvc iRpcDestinationSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询目的地列表
|
* 查询目的地列表
|
||||||
*/
|
*/
|
||||||
@ -64,30 +68,15 @@ public class Oms2cDestinationController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据客户信息获取目的地站点
|
* 根据客户信息获取目的地站点
|
||||||
* @param province
|
* @param province
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getDestSite")
|
@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)
|
public AjaxResult getDestSite(String country, String lineCode, String province, String city, String county, String address)
|
||||||
{
|
{
|
||||||
if(StringUtils.isAnyEmpty(province)){
|
return iRpcDestinationSvc.getDestSite(country,lineCode,province,city,county,address);
|
||||||
return AjaxResult.error("参数错误,省份不能为空!");
|
|
||||||
}
|
|
||||||
|
|
||||||
EmisDestination dest = emisDestinationService.calcDestSite(country,lineCode,province,city,county,address);
|
|
||||||
if(dest==null){
|
|
||||||
return AjaxResult.error("联系客户,收件地不在服务范围!");
|
|
||||||
}else{
|
|
||||||
return AjaxResult.success("获取成功",dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,20 +85,9 @@ public class Oms2cDestinationController extends BaseController
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getSendSite")
|
@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)
|
public AjaxResult getSendSite(String country, String lineCode, String province, String city, String county, String address)
|
||||||
{
|
{
|
||||||
if(StringUtils.isAnyEmpty(province)){
|
return iRpcDestinationSvc.getSendSite(country,lineCode,province,city,county,address);
|
||||||
return AjaxResult.error("参数错误,省份不能为空!");
|
|
||||||
}
|
|
||||||
EmisDestination dest = emisDestinationService.calcSendSite(country,lineCode,province,city,county,address);
|
|
||||||
if(dest==null){
|
|
||||||
return AjaxResult.error("联系客户,收件地不在服务范围!");
|
|
||||||
}else{
|
|
||||||
return AjaxResult.success("获取成功",dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,12 +20,6 @@ import com.xdadan.erp.oms.domain.EmisDestination;
|
|||||||
*/
|
*/
|
||||||
public interface IEmisDestinationService
|
public interface IEmisDestinationService
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 主键查询
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public EmisDestination selectEmisDestinationById(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询目的地列表
|
* 查询目的地列表
|
||||||
@ -36,19 +30,4 @@ public interface IEmisDestinationService
|
|||||||
public List<EmisDestination> selectEmisDestinationList(EmisDestination emisDestination);
|
public List<EmisDestination> 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);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,23 +37,6 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmisDestinationMapper emisDestinationMapper;
|
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<EmisRegion> 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<EmisDestination> 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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user