md
This commit is contained in:
parent
76dd133828
commit
fdf002e44b
@ -90,5 +90,27 @@ public class Oms2cDestinationController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户信息获取寄件网点
|
||||||
|
* @param province
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class EmisCountryArea extends BaseEntity
|
public class EmisCountryArea extends BaseEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/* 区域序号 */
|
/* 区域序号 */
|
||||||
@ -35,6 +36,13 @@ public class EmisCountryArea extends BaseEntity
|
|||||||
private String countryCode;
|
private String countryCode;
|
||||||
/* 国际名称 */
|
/* 国际名称 */
|
||||||
private String countryName;
|
private String countryName;
|
||||||
|
/* 服务网点 */
|
||||||
|
private String siteCode;
|
||||||
|
|
||||||
|
// 扩展字段
|
||||||
|
// 服务网点名称
|
||||||
|
private String siteName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,12 +47,15 @@ public interface IEmisDestinationService
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
/**
|
public EmisDestination calcSendSite(String country,String lineCode, String province, String city, String county, String address);
|
||||||
* 新增目的地
|
|
||||||
*
|
|
||||||
* @param emisDestination 目的地
|
/**
|
||||||
* @return 结果
|
* 新增目的地
|
||||||
*/
|
*
|
||||||
|
* @param emisDestination 目的地
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
public int insertEmisDestination(EmisDestination emisDestination);
|
public int insertEmisDestination(EmisDestination emisDestination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -13,15 +13,20 @@ package com.xdadan.erp.oms.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.xdadan.erp.oms.domain.EmisCountryArea;
|
||||||
import com.xdadan.erp.oms.domain.EmisRegion;
|
import com.xdadan.erp.oms.domain.EmisRegion;
|
||||||
|
import com.xdadan.erp.oms.mapper.EmisCountryAreaMapper;
|
||||||
import com.xdadan.erp.oms.mapper.EmisRegionMapper;
|
import com.xdadan.erp.oms.mapper.EmisRegionMapper;
|
||||||
|
import com.xdadan.erp.oms.service.IEmisCountryAreaService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xdadan.erp.oms.domain.EmisDestination;
|
import com.xdadan.erp.oms.domain.EmisDestination;
|
||||||
import com.xdadan.erp.oms.mapper.EmisDestinationMapper;
|
import com.xdadan.erp.oms.mapper.EmisDestinationMapper;
|
||||||
import com.xdadan.erp.oms.service.IEmisDestinationService;
|
import com.xdadan.erp.oms.service.IEmisDestinationService;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目的地Service业务层处理
|
* 目的地Service业务层处理
|
||||||
*
|
*
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -36,6 +41,9 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmisRegionMapper emisRegionMapper;
|
private EmisRegionMapper emisRegionMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisCountryAreaMapper emisCountryAreaMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询目的地
|
* 查询目的地
|
||||||
*
|
*
|
||||||
@ -60,8 +68,81 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
|
|||||||
return emisDestinationMapper.selectEmisDestinationList(emisDestination);
|
return emisDestinationMapper.selectEmisDestinationList(emisDestination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 lineCode
|
||||||
* @param province
|
* @param province
|
||||||
* @param city
|
* @param city
|
||||||
@ -70,42 +151,50 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
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) {
|
||||||
|
|
||||||
// 目前只根据目的省份获取目的地
|
|
||||||
|
|
||||||
|
EmisDestination destination=null;
|
||||||
// 获取 areaId
|
// 获取 areaId
|
||||||
Long areaId = null;
|
Long areaId = null;
|
||||||
EmisRegion queryEmisRegion = new EmisRegion();
|
|
||||||
queryEmisRegion.setRegionCode(province);
|
|
||||||
List<EmisRegion> regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
|
|
||||||
if(!CollectionUtil.isEmpty(regionList)){
|
|
||||||
areaId = regionList.get(0).getAreaId();
|
|
||||||
country = regionList.get(0).getCountryCode();
|
|
||||||
|
|
||||||
// 根据大区获取目的网点
|
// 根据区获取目的地
|
||||||
EmisDestination queryEmisDestination = new EmisDestination();
|
if(!StringUtils.isEmpty(county)) {
|
||||||
queryEmisDestination.setCountryAreaId(areaId);
|
EmisRegion regionCounty = getRegionByCode(county);
|
||||||
queryEmisDestination.setStatus(1);
|
if (regionCounty != null) {
|
||||||
List<EmisDestination> destinationList=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
|
areaId = regionCounty.getAreaId();
|
||||||
if(!CollectionUtil.isEmpty(destinationList)){
|
|
||||||
return destinationList.get(0);
|
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
// 根据国家查询
|
|
||||||
queryEmisDestination = new EmisDestination();
|
|
||||||
queryEmisDestination.setCountry(country);
|
// 根据城市获取目的地
|
||||||
queryEmisDestination.setStatus(1);
|
if( (areaId==null || areaId==0) && !StringUtils.isEmpty(city)) {
|
||||||
destinationList=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
|
EmisRegion regionCity = getRegionByCode(city);
|
||||||
if(!CollectionUtil.isEmpty(destinationList)){
|
if (regionCity != null) {
|
||||||
return destinationList.get(0);
|
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){
|
||||||
|
EmisDestination emisDestination = new EmisDestination();
|
||||||
|
emisDestination.setSiteCode(emisCountryArea.getSiteCode());
|
||||||
|
emisDestination.setSiteName(emisCountryArea.getSiteName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return destination;
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,23 +10,26 @@
|
|||||||
<result property="nameEn" column="name_en" />
|
<result property="nameEn" column="name_en" />
|
||||||
<result property="countryCode" column="country_code" />
|
<result property="countryCode" column="country_code" />
|
||||||
<result property="countryName" column="country_name" />
|
<result property="countryName" column="country_name" />
|
||||||
|
<result property="siteCode" column="site_code" />
|
||||||
|
|
||||||
|
<association property="siteName" column="site_code" select="com.xdadan.erp.oms.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmisCountryAreaVo">
|
<sql id="selectEmisCountryAreaVo">
|
||||||
select id, name, name_en, country_code, country_name, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_country_area
|
select id, name, name_en, country_code, country_name, site_code, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_country_area
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmisCountryAreaList" parameterType="EmisCountryArea" resultMap="EmisCountryAreaResult">
|
<select id="selectEmisCountryAreaList" parameterType="EmisCountryArea" resultMap="EmisCountryAreaResult">
|
||||||
<include refid="selectEmisCountryAreaVo"/>
|
<include refid="selectEmisCountryAreaVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
del_flag='0'
|
||||||
<if test="id != null "> and id = #{id}</if>
|
<if test="id != null "> and id = #{id}</if>
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
|
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
|
||||||
<if test="countryCode != null and countryCode != ''"> and country_code like concat('%', #{countryCode}, '%')</if>
|
<if test="countryCode != null and countryCode != ''"> and country_code like concat('%', #{countryCode}, '%')</if>
|
||||||
<if test="countryName != null and countryName != ''"> and country_name like concat('%', #{countryName}, '%')</if>
|
<if test="countryName != null and countryName != ''"> and country_name like concat('%', #{countryName}, '%')</if>
|
||||||
|
<if test="siteCode != null and siteCode != ''"> and site_code like concat('%', #{siteCode}, '%')</if>
|
||||||
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
||||||
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
|
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
|
||||||
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
||||||
@ -40,13 +43,34 @@
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="checkUnique" parameterType="EmisCountryArea" resultType="int">
|
||||||
|
select count(1) from emis_country_area
|
||||||
|
where del_flag='0'
|
||||||
|
and id = #{id}
|
||||||
|
and name = #{name}
|
||||||
|
and name_en = #{nameEn}
|
||||||
|
and country_code = #{countryCode}
|
||||||
|
and country_name = #{countryName}
|
||||||
|
and site_code = #{siteCode}
|
||||||
|
and remark = #{remark}
|
||||||
|
and tenant_id = #{tenantId}
|
||||||
|
and del_flag = #{delFlag}
|
||||||
|
and create_by = #{createBy}
|
||||||
|
and create_time = #{createTime}
|
||||||
|
and update_by = #{updateBy}
|
||||||
|
and update_time = #{updateTime}
|
||||||
|
and create_site = #{createSite}
|
||||||
|
and update_site = #{updateSite}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectEmisCountryAreaById" parameterType="Long" resultMap="EmisCountryAreaResult">
|
<select id="selectEmisCountryAreaById" parameterType="Long" resultMap="EmisCountryAreaResult">
|
||||||
select id, name, name_en, country_code, country_name, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
select id, name, name_en, country_code, country_name, site_code, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
from emis_country_area a
|
from emis_country_area a
|
||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertEmisCountryArea" parameterType="EmisCountryArea">
|
<insert id="insertEmisCountryArea" parameterType="EmisCountryArea" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into emis_country_area
|
insert into emis_country_area
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">id,</if>
|
<if test="id != null">id,</if>
|
||||||
@ -54,6 +78,7 @@
|
|||||||
<if test="nameEn != null and nameEn != ''">name_en,</if>
|
<if test="nameEn != null and nameEn != ''">name_en,</if>
|
||||||
<if test="countryCode != null and countryCode != ''">country_code,</if>
|
<if test="countryCode != null and countryCode != ''">country_code,</if>
|
||||||
<if test="countryName != null and countryName != ''">country_name,</if>
|
<if test="countryName != null and countryName != ''">country_name,</if>
|
||||||
|
<if test="siteCode != null and siteCode != ''">site_code,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
||||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||||
@ -70,6 +95,7 @@
|
|||||||
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
|
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
|
||||||
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
|
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
|
||||||
<if test="countryName != null and countryName != ''">#{countryName},</if>
|
<if test="countryName != null and countryName != ''">#{countryName},</if>
|
||||||
|
<if test="siteCode != null and siteCode != ''">#{siteCode},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
||||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||||
@ -89,6 +115,7 @@
|
|||||||
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
|
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
|
||||||
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
|
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
|
||||||
<if test="countryName != null and countryName != ''">country_name = #{countryName},</if>
|
<if test="countryName != null and countryName != ''">country_name = #{countryName},</if>
|
||||||
|
<if test="siteCode != null and siteCode != ''">site_code = #{siteCode},</if>
|
||||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||||
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
||||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user