md
This commit is contained in:
parent
fccf2a61b9
commit
e7870fb350
@ -77,5 +77,7 @@ public class EmisCustomerAddress extends BaseEntity
|
||||
private String cityName;
|
||||
private String countyName;
|
||||
|
||||
/* 使用站点名称 */
|
||||
private String useSiteName;
|
||||
|
||||
}
|
||||
|
||||
@ -58,6 +58,8 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
*/
|
||||
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
@ -100,4 +102,20 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
public int checkUnique(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
|
||||
/**
|
||||
* 查询重复的地址,并且给客户打上标签
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
*/
|
||||
public List<EmisCustomerAddress> selectExistAddressList(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
/**
|
||||
* 更新地址归属客户
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
*/
|
||||
public int updateAddessCustomerCodeAndUseSite(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -524,8 +524,6 @@ public class EmisBaseService {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer subSeqNum=Integer.valueOf(subBillSuffix);
|
||||
order.put("subSeqNum", waybill.getOrderSn());
|
||||
}
|
||||
|
||||
|
||||
@ -972,30 +970,41 @@ public class EmisBaseService {
|
||||
int cnt=emisCustomerAddressMapper.checkUnique(emisCustomerAddressNew);
|
||||
if(cnt==0){
|
||||
// 不重复的情况则 创建地址
|
||||
emisCustomerAddressNew.setId(null);
|
||||
emisCustomerAddressNew.preInsert();
|
||||
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
|
||||
}else{
|
||||
|
||||
// 重复则只修改,不增加
|
||||
EmisCustomerAddress queryObj=new EmisCustomerAddress();
|
||||
queryObj.setCounty(emisCustomerAddressNew.getCounty());
|
||||
queryObj.setName(emisCustomerAddressNew.getName());
|
||||
queryObj.setPhone(emisCustomerAddressNew.getPhone());
|
||||
queryObj.setProvince(emisCustomerAddressNew.getProvince());
|
||||
queryObj.setCity();
|
||||
queryObj.setCity(emisCustomerAddressNew.getCity());
|
||||
queryObj.setCounty(emisCustomerAddressNew.getCounty());
|
||||
queryObj.setAddressType(emisCustomerAddressNew.getAddressType());
|
||||
queryObj.setAddress(emisCustomerAddressNew.getAddress());
|
||||
queryObj.setCompany(emisCustomerAddressNew.getCompany());
|
||||
|
||||
List<EmisCustomerAddress> existList=emisCustomerAddressMapper.selectEmisCustomerAddressList();
|
||||
List<EmisCustomerAddress> existList=emisCustomerAddressMapper.selectExistAddressList(queryObj);
|
||||
// 重复数据需要修正地址的客户归属
|
||||
// get
|
||||
|
||||
if(existList!=null){
|
||||
for (EmisCustomerAddress cusddress:existList) {
|
||||
if(StringUtils.isEmpty(cusddress.getCustomerCode())){
|
||||
// 增加使用站点
|
||||
String useSiteCode = emisCustomerAddressNew.getUseSiteCode();
|
||||
if(useSiteCode.indexOf(emisCustomerAddressNew.getUseSiteCode())==-1){
|
||||
cusddress.setUseSiteCode(useSiteCode+","+emisCustomerAddressNew.getUseSiteCode());
|
||||
}
|
||||
cusddress.setCustomerCode(emisCustomerAddressNew.getCustomerCode());
|
||||
emisCustomerAddressMapper.updateAddessCustomerCodeAndUseSite(cusddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(emisCustomerAddressNew.getCustomerCode())){
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
<association property="provinceName" column="province" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectRegionNameByCode"/>
|
||||
<association property="cityName" column="city" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectRegionNameByCode"/>
|
||||
<association property="countyName" column="county" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectRegionNameByCode"/>
|
||||
<association property="useSiteName" column="use_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisCustomerAddressVo">
|
||||
@ -74,7 +76,7 @@
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
<if test="useSiteCode != null and useSiteCode != ''"> and use_site_code=#{useSiteCode}</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''"> and FIND_IN_SET(use_site_code, #{useSiteCode})</if>
|
||||
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and ( name like concat(#{searchValue}, '%') or phone like concat(#{searchValue}, '%') or company like concat(#{searchValue}, '%') )
|
||||
@ -211,6 +213,25 @@
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateAddessCustomerCodeAndUseSite" parameterType="EmisCustomerAddress">
|
||||
update emis_customer_address set customer_code = #{customerCode},use_site_code=#{useSiteCode} where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectExistAddressList" parameterType="EmisCustomerAddress" resultMap="EmisCustomerAddressResult">
|
||||
select id,customer_code,use_site_code from emis_customer_address
|
||||
where del_flag='0'
|
||||
and country = #{country}
|
||||
and `name` = #{name}
|
||||
and phone = #{phone}
|
||||
and province = #{province}
|
||||
and city = #{city}
|
||||
and county = #{county}
|
||||
and address = #{address}
|
||||
and company = #{company}
|
||||
and address_type = #{addressType}
|
||||
and customer_code is null
|
||||
</select>
|
||||
|
||||
<select id="checkUnique" parameterType="EmisCustomerAddress" resultType="int">
|
||||
select count(1) from emis_customer_address
|
||||
where del_flag='0'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user