md
This commit is contained in:
parent
76d0b1045c
commit
8bfd328ee6
@ -82,9 +82,9 @@ public class EmisCustomerAddressController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping("/setDefaultAddressById")
|
@RequestMapping("/setDefaultAddressById")
|
||||||
public AjaxResult setDefaultAddressById(@RequestParam("id") Long id)
|
public AjaxResult setDefaultAddressById(@RequestParam("id") Long id,String defaultFlag)
|
||||||
{
|
{
|
||||||
return toAjax(emisCustomerAddressService.setDefaultAddressById(id));
|
return toAjax(emisCustomerAddressService.setDefaultAddressById(id,defaultFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/deleteAddressById")
|
@RequestMapping("/deleteAddressById")
|
||||||
|
|||||||
@ -64,6 +64,8 @@ public class EmisCustomerAddress extends BaseEntity
|
|||||||
private String blDefaultFlag;
|
private String blDefaultFlag;
|
||||||
/* 排序 */
|
/* 排序 */
|
||||||
private Integer orderNum;
|
private Integer orderNum;
|
||||||
|
/* 使用站点是否默认 */
|
||||||
|
private String blSiteDefaultFlag;
|
||||||
/* 使用站点名称 */
|
/* 使用站点名称 */
|
||||||
private String useSite;
|
private String useSite;
|
||||||
/* 使用站点代码 */
|
/* 使用站点代码 */
|
||||||
|
|||||||
@ -72,8 +72,20 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
|||||||
public int deleteEmisCustomerAddressByIds(Long[] ids);
|
public int deleteEmisCustomerAddressByIds(Long[] ids);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消站点确认默认地址
|
||||||
|
* @param useSiteCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int cancelUseSiteDefaultFlag(String useSiteCode);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
* @param useSiteCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int cancelCustomerDefaultFlag(String useSiteCode);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ package com.xdadan.erp.emis.service;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.lang.Snowflake;
|
import cn.hutool.core.lang.Snowflake;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
||||||
import com.xdadan.erp.common.utils.DateUtils;
|
import com.xdadan.erp.common.utils.DateUtils;
|
||||||
import com.xdadan.erp.common.utils.SecurityUtils;
|
import com.xdadan.erp.common.utils.SecurityUtils;
|
||||||
|
|||||||
@ -67,6 +67,12 @@ public interface IEmisCustomerAddressService
|
|||||||
*/
|
*/
|
||||||
public int deleteEmisCustomerAddressById(Long id);
|
public int deleteEmisCustomerAddressById(Long id);
|
||||||
|
|
||||||
public int setDefaultAddressById(Long id);
|
/**
|
||||||
|
* 设置客户默认地址
|
||||||
|
* @param id
|
||||||
|
* @param defaultFlag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int setDefaultAddressById(Long id,String defaultFlag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,6 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I
|
|||||||
emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName());
|
emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName());
|
||||||
|
|
||||||
// 创建用户
|
// 创建用户
|
||||||
|
|
||||||
|
|
||||||
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddress);
|
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,16 +120,35 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int setDefaultAddressById(Long id){
|
public int setDefaultAddressById(Long id,String defaultFlag){
|
||||||
UpdateWrapper<EmisCustomerAddress> updateWrapper = new UpdateWrapper<>();
|
|
||||||
updateWrapper.set("bl_default_flag", "0");
|
EmisCustomerAddress oldAddress=emisCustomerAddressMapper.selectEmisCustomerAddressById(id);
|
||||||
updateWrapper.eq("bl_default_flag", "1");
|
|
||||||
emisCustomerAddressMapper.update(null,updateWrapper);
|
if("1".equals(defaultFlag)){
|
||||||
|
|
||||||
|
if(oldAddress != null ){
|
||||||
|
// 取消对应客户所有默认
|
||||||
|
emisCustomerAddressMapper.cancelCustomerDefaultFlag(oldAddress.getCustomerCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置当前为1
|
||||||
|
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||||
|
emisCustomerAddress.setBlDefaultFlag("1");
|
||||||
|
emisCustomerAddress.setId(id);
|
||||||
|
emisCustomerAddress.preUpdate();
|
||||||
|
emisCustomerAddressMapper.updateById(emisCustomerAddress);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 设置当前
|
||||||
|
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||||
|
emisCustomerAddress.setBlDefaultFlag("0");
|
||||||
|
emisCustomerAddress.setId(id);
|
||||||
|
emisCustomerAddress.preUpdate();
|
||||||
|
emisCustomerAddressMapper.updateById(emisCustomerAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
UpdateWrapper<EmisCustomerAddress> updateWrapper2 = new UpdateWrapper<>();
|
|
||||||
updateWrapper2.set("bl_default_flag", "1");
|
|
||||||
updateWrapper.eq("id", id);
|
|
||||||
return emisCustomerAddressMapper.update(null,updateWrapper2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ package com.xdadan.erp.emis.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.xdadan.erp.common.core.domain.entity.SysTenant;
|
import com.xdadan.erp.common.core.domain.entity.SysTenant;
|
||||||
import com.xdadan.erp.emis.domain.EmisRegion;
|
import com.xdadan.erp.emis.domain.EmisRegion;
|
||||||
import com.xdadan.erp.emis.mapper.EmisRegionMapper;
|
import com.xdadan.erp.emis.mapper.EmisRegionMapper;
|
||||||
@ -81,16 +80,21 @@ public class EmisDestinationServiceImpl implements IEmisDestinationService
|
|||||||
queryEmisRegion.setRegionCode(province);
|
queryEmisRegion.setRegionCode(province);
|
||||||
List<EmisRegion> regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
|
List<EmisRegion> regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
|
||||||
if(CollectionUtil.isEmpty(regionList)){
|
if(CollectionUtil.isEmpty(regionList)){
|
||||||
|
|
||||||
// 如果身份按国家获取第一个区域
|
// 如果身份按国家获取第一个区域
|
||||||
QueryWrapper<EmisRegion> queryWrapper = new QueryWrapper<>();
|
queryEmisRegion = new EmisRegion();
|
||||||
// 按省份获取区域
|
// 按省份获取区域
|
||||||
queryWrapper.eq("region_type", "1");
|
queryEmisRegion.setRegionType(1);
|
||||||
queryWrapper.eq("country_code", country);
|
queryEmisRegion.setCountryCode(country);
|
||||||
queryWrapper.isNotNull("area_id");
|
regionList= emisRegionMapper.selectEmisRegionList(queryEmisRegion);
|
||||||
queryWrapper.last("limit 1");
|
|
||||||
regionList=emisRegionMapper.selectList(queryWrapper);
|
|
||||||
if(!CollectionUtil.isEmpty(regionList)){
|
if(!CollectionUtil.isEmpty(regionList)){
|
||||||
areaId = regionList.get(0).getAreaId();
|
for (EmisRegion emisRegion:regionList) {
|
||||||
|
if(emisRegion.getAreaId()!=null){
|
||||||
|
areaId = emisRegion.getAreaId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ package com.xdadan.erp.emis.service.impl;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
<result property="company" column="company" />
|
<result property="company" column="company" />
|
||||||
<result property="blDefaultFlag" column="bl_default_flag" />
|
<result property="blDefaultFlag" column="bl_default_flag" />
|
||||||
<result property="orderNum" column="order_num" />
|
<result property="orderNum" column="order_num" />
|
||||||
|
<result property="blSiteDefaultFlag" column="bl_site_default_flag" />
|
||||||
<result property="useSite" column="use_site" />
|
<result property="useSite" column="use_site" />
|
||||||
<result property="useSiteCode" column="use_site_code" />
|
<result property="useSiteCode" column="use_site_code" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
@ -42,7 +43,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmisCustomerAddressVo">
|
<sql id="selectEmisCustomerAddressVo">
|
||||||
select id, user_id, customer_code, short_name, alias, address_type, country, name, phone, province, city, county, town, address, post_code, email, company, bl_default_flag, order_num, use_site, use_site_code, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_customer_address
|
select id, user_id, customer_code, short_name, alias, address_type, country, name, phone, province, city, county, town, address, post_code, email, company, bl_default_flag, order_num, bl_site_default_flag, use_site, use_site_code, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_customer_address
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@ -75,9 +76,10 @@
|
|||||||
<if test="postCode != null and postCode != ''"> and post_code like concat('%', #{postCode}, '%')</if>
|
<if test="postCode != null and postCode != ''"> and post_code like concat('%', #{postCode}, '%')</if>
|
||||||
<if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
|
<if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
|
||||||
<if test="company != null and company != ''"> and company like concat('%', #{company}, '%')</if>
|
<if test="company != null and company != ''"> and company like concat('%', #{company}, '%')</if>
|
||||||
<if test="blDefaultFlag != null and blDefaultFlag != ''"> and bl_default_flag like concat('%', #{blDefaultFlag}, '%')</if>
|
<if test="blDefaultFlag != null and blDefaultFlag != ''"> and bl_default_flag = #{blDefaultFlag}</if>
|
||||||
<if test="orderNum != null and orderNum != ''"> and order_num like concat('%', #{orderNum}, '%')</if>
|
<if test="orderNum != null "> and order_num like concat('%', #{orderNum}, '%')</if>
|
||||||
<if test="useSite != null and useSite != ''"> and use_site like concat('%', #{useSite}, '%')</if>
|
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''"> and bl_site_default_flag like concat('%', #{blSiteDefaultFlag}, '%')</if>
|
||||||
|
<if test="useSite != null and useSite != ''"> and use_site = #{useSite}</if>
|
||||||
<if test="useSiteCode != null and useSiteCode != ''"> and use_site_code=#{useSiteCode}</if>
|
<if test="useSiteCode != null and useSiteCode != ''"> and use_site_code=#{useSiteCode}</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>
|
||||||
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
||||||
@ -97,13 +99,11 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEmisCustomerAddressById" parameterType="Long" resultMap="EmisCustomerAddressResult">
|
<select id="selectEmisCustomerAddressById" parameterType="Long" resultMap="EmisCustomerAddressResult">
|
||||||
select id, user_id, customer_code, short_name, alias, address_type, country, name, phone, province, city, county, town, address, post_code, email, company, bl_default_flag, order_num, use_site, use_site_code, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
select id, user_id, customer_code, short_name, alias, address_type, country, name, phone, province, city, county, town, address, post_code, email, company, bl_default_flag, order_num, bl_site_default_flag, use_site, use_site_code, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||||
from emis_customer_address a
|
from emis_customer_address a
|
||||||
where a.id = #{id}
|
where a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertEmisCustomerAddress" parameterType="EmisCustomerAddress">
|
<insert id="insertEmisCustomerAddress" parameterType="EmisCustomerAddress">
|
||||||
insert into emis_customer_address
|
insert into emis_customer_address
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@ -125,7 +125,8 @@
|
|||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="company != null and company != ''">company,</if>
|
<if test="company != null and company != ''">company,</if>
|
||||||
<if test="blDefaultFlag != null and blDefaultFlag != ''">bl_default_flag,</if>
|
<if test="blDefaultFlag != null and blDefaultFlag != ''">bl_default_flag,</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
<if test="orderNum != null">order_num,</if>
|
||||||
|
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">bl_site_default_flag,</if>
|
||||||
<if test="useSite != null and useSite != ''">use_site,</if>
|
<if test="useSite != null and useSite != ''">use_site,</if>
|
||||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
||||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||||
@ -156,7 +157,8 @@
|
|||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
<if test="company != null and company != ''">#{company},</if>
|
<if test="company != null and company != ''">#{company},</if>
|
||||||
<if test="blDefaultFlag != null and blDefaultFlag != ''">#{blDefaultFlag},</if>
|
<if test="blDefaultFlag != null and blDefaultFlag != ''">#{blDefaultFlag},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
<if test="orderNum != null">#{orderNum},</if>
|
||||||
|
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">#{blSiteDefaultFlag},</if>
|
||||||
<if test="useSite != null and useSite != ''">#{useSite},</if>
|
<if test="useSite != null and useSite != ''">#{useSite},</if>
|
||||||
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
||||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||||
@ -190,7 +192,8 @@
|
|||||||
<if test="email != null and email != ''">email = #{email},</if>
|
<if test="email != null and email != ''">email = #{email},</if>
|
||||||
<if test="company != null and company != ''">company = #{company},</if>
|
<if test="company != null and company != ''">company = #{company},</if>
|
||||||
<if test="blDefaultFlag != null and blDefaultFlag != ''">bl_default_flag = #{blDefaultFlag},</if>
|
<if test="blDefaultFlag != null and blDefaultFlag != ''">bl_default_flag = #{blDefaultFlag},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||||
|
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">bl_site_default_flag = #{blSiteDefaultFlag},</if>
|
||||||
<if test="useSite != null and useSite != ''">use_site = #{useSite},</if>
|
<if test="useSite != null and useSite != ''">use_site = #{useSite},</if>
|
||||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
||||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||||
@ -215,4 +218,13 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="cancelUseSiteDefaultFlag" parameterType="String">
|
||||||
|
update emis_customer_address set bl_default_flag = '0' where use_site_code = #{useSiteCode}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="cancelCustomerDefaultFlag" parameterType="String">
|
||||||
|
update emis_customer_address set bl_site_default_flag = '0' where customer_code = #{customerCode}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user