demand: tms/app运单录入、运单修改、运单批量录入、网点费用申请增加录入企业名称、企业税号的功能 tms/app运单录入、运单修改、运单批量录入、网点费用申请录入企业名称、企业税号后自动同步更新/新增到寄件人信息 tms-客户管理-寄件人地址-增加根据企业名称、企业税号模糊查询的功能,查询返回增加企业名称、企业税号,新增接口增加添加企业名称、企业税号的功能
committer: heyu
This commit is contained in:
parent
5d08c18526
commit
5415a86161
@ -83,4 +83,9 @@ public class EmisCustomerAddress extends BaseEntity
|
||||
/* 使用站点名称 */
|
||||
private String useSiteName;
|
||||
|
||||
/* 企业名称 */
|
||||
private String enterpriseName;
|
||||
/* 企业税号 */
|
||||
private String enterpriseTaxId;
|
||||
|
||||
}
|
||||
|
||||
@ -156,6 +156,10 @@ public class EmisWaybill extends BaseEntity
|
||||
private String sendPostcode;
|
||||
/* 发件人省市区名称,逗号分隔 */
|
||||
private String sendPcd;
|
||||
/* 企业名称 */
|
||||
private String enterpriseName;
|
||||
/* 企业税号 */
|
||||
private String enterpriseTaxId;
|
||||
/* 支付方式 : 现金或月结 */
|
||||
@TableField
|
||||
@DataAuditField(fieldComment = "支付方式",dictType="emis_payment_type")
|
||||
|
||||
@ -41,4 +41,8 @@ public class Sender implements Serializable {
|
||||
private String email;
|
||||
/* 公司 */
|
||||
private String company;
|
||||
/* 企业名称 */
|
||||
private String enterpriseName;
|
||||
/* 企业税号 */
|
||||
private String enterpriseTaxId;
|
||||
}
|
||||
|
||||
@ -785,6 +785,8 @@ public class WaybillOrder implements Serializable {
|
||||
dbWaybill.setSendAddress(sender.getAddress());
|
||||
dbWaybill.setSendPostcode(sender.getPostCode());
|
||||
dbWaybill.setSendCompany(sender.getCompany());
|
||||
dbWaybill.setEnterpriseName(sender.getEnterpriseName());
|
||||
dbWaybill.setEnterpriseTaxId(sender.getEnterpriseTaxId());
|
||||
}
|
||||
|
||||
dbWaybill.setPaymentType(this.getPaymentType());
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisCustomerAddressMapper.java
|
||||
* @author linfso
|
||||
* @date 2024-03-01 04:47:51
|
||||
* @Copyright: ShangHai Doitinfo 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 客户收寄件地址 Mapper 接口 </p>
|
||||
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
|
||||
*/
|
||||
@ -30,31 +30,31 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public EmisCustomerAddress selectEmisCustomerAddressById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
* @return 集合
|
||||
*/
|
||||
public List<EmisCustomerAddress> selectEmisCustomerAddressList(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public int insertEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
*/
|
||||
public int updateEmisCustomerAddress(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
@ -62,7 +62,7 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -70,7 +70,7 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -101,6 +101,14 @@ public interface EmisCustomerAddressMapper extends BaseMapper<EmisCustomerAddres
|
||||
*/
|
||||
public int checkUnique(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
* @param emisCustomerAddress
|
||||
* @return
|
||||
*/
|
||||
public List<EmisCustomerAddress> checkAndQuery(EmisCustomerAddress emisCustomerAddress);
|
||||
|
||||
|
||||
/**
|
||||
* 查询重复的地址,并且给客户打上标签
|
||||
|
||||
@ -3552,6 +3552,58 @@ public class EmisBaseService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据添加的地址增加客户
|
||||
*
|
||||
* @param emisCustomerAddressNew
|
||||
* @return
|
||||
*/
|
||||
public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
||||
|
||||
if ("2".equals(emisCustomerAddressNew.getAddressType())) {
|
||||
if ("0086".equals(emisCustomerAddressNew.getCounty())) {
|
||||
if (StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseTaxId()) || StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseName())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "企业名称/企业税号不能为空");
|
||||
}
|
||||
// 验证企业名称格式
|
||||
if (!validateEnterpriseName(emisCustomerAddressNew.getEnterpriseName())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业名称不能包含空格、回车、@、#、$、%、&、数字等特殊符号");
|
||||
}
|
||||
|
||||
// 验证企业税号格式
|
||||
if (!validateEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "企业税号必须为8-18位数字和大写字母组成,不能包含汉字、空格等特殊符号");
|
||||
}
|
||||
} else {
|
||||
emisCustomerAddressNew.setEnterpriseName(null);
|
||||
emisCustomerAddressNew.setEnterpriseTaxId(null);
|
||||
}
|
||||
} else {
|
||||
emisCustomerAddressNew.setEnterpriseName(null);
|
||||
emisCustomerAddressNew.setEnterpriseTaxId(null);
|
||||
}
|
||||
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddressNew);
|
||||
if (CollectionUtil.isEmpty(emisCustomerAddressList)) {
|
||||
// 不重复的情况则 创建地址
|
||||
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
|
||||
} else {
|
||||
if ("2".equals(emisCustomerAddressNew.getAddressType()) && "0086".equals(emisCustomerAddressNew.getCounty())) {
|
||||
List<Long> emisCustomerAddressIds = emisCustomerAddressList.stream().filter(i -> (StringUtil.isBlank(i.getEnterpriseTaxId()) || StringUtil.isBlank(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(emisCustomerAddressIds)) {
|
||||
return 1;
|
||||
}
|
||||
for (Long id : emisCustomerAddressIds) {
|
||||
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||
emisCustomerAddress.setId(id);
|
||||
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
|
||||
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
|
||||
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据添加的地址增加客户
|
||||
@ -3572,6 +3624,49 @@ public class EmisBaseService {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证企业名称格式
|
||||
* 不允许包含空格、回车、@、#、$、%、&、数字等特殊符号
|
||||
*/
|
||||
public boolean validateEnterpriseName(String enterpriseName) {
|
||||
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(enterpriseName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否包含不允许的字符
|
||||
String invalidChars = " @#$%&0123456789";
|
||||
for (char c : invalidChars.toCharArray()) {
|
||||
if (enterpriseName.contains(String.valueOf(c))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否包含回车符
|
||||
if (enterpriseName.contains("\n") || enterpriseName.contains("\r")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证企业税号格式
|
||||
* 8-18位数组成,由数字和大写字母组成,不允许有汉字、空格等特殊符号
|
||||
*/
|
||||
public boolean validateEnterpriseTaxId(String enterpriseTaxId) {
|
||||
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(enterpriseTaxId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查长度
|
||||
if (enterpriseTaxId.length() < 8 || enterpriseTaxId.length() > 18) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否只包含数字和大写字母
|
||||
return enterpriseTaxId.matches("^[0-9A-Z]+$");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取线路
|
||||
* @param code
|
||||
|
||||
@ -2510,6 +2510,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
sendAddress.setAddressType("1");
|
||||
sendAddress.setEnterpriseName(emisWaybillSave.getEnterpriseName());
|
||||
sendAddress.setEnterpriseTaxId(emisWaybillSave.getEnterpriseTaxId());
|
||||
|
||||
// 收件地址
|
||||
EmisCustomerAddress recieveAddress = new EmisCustomerAddress();
|
||||
@ -2626,7 +2628,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
// 保存客户收件、寄件地址,开单不要关联客户地址数据
|
||||
createCustomerAddress(sendAddress);
|
||||
createCustomerAddressNew(sendAddress);
|
||||
createCustomerAddress(recieveAddress);
|
||||
|
||||
emisWaybillSave.setCustomerCode(customerCode);
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
<result property="blSiteDefaultFlag" column="bl_site_default_flag" />
|
||||
<result property="useSite" column="use_site" />
|
||||
<result property="useSiteCode" column="use_site_code" />
|
||||
<result property="enterpriseName" column="enterprise_name" />
|
||||
<result property="enterpriseTaxId" column="enterprise_tax_id" />
|
||||
|
||||
|
||||
<association property="countryName" column="country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
|
||||
@ -38,7 +40,7 @@
|
||||
</resultMap>
|
||||
|
||||
<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, 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
|
||||
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, enterprise_name, enterprise_tax_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_customer_address
|
||||
</sql>
|
||||
|
||||
|
||||
@ -63,6 +65,8 @@
|
||||
<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="company != null and company != ''"> and company like concat('%', #{company}, '%')</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''"> and enterprise_tax_id like concat('%', #{enterpriseTaxId}, '%')</if>
|
||||
<if test="blDefaultFlag != null and blDefaultFlag != ''"> and bl_default_flag = #{blDefaultFlag}</if>
|
||||
<if test="orderNum != null "> and order_num like concat('%', #{orderNum}, '%')</if>
|
||||
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''"> and bl_site_default_flag like concat('%', #{blSiteDefaultFlag}, '%')</if>
|
||||
@ -79,7 +83,7 @@
|
||||
<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}, '%') )
|
||||
and ( name like concat('%',#{searchValue}, '%') or phone like concat('%',#{searchValue}, '%') or company like concat('%',#{searchValue}, '%') or enterprise_name like concat('%',#{searchValue}, '%') or enterprise_tax_id like concat('%',#{searchValue}, '%') )
|
||||
</if>
|
||||
|
||||
</where>
|
||||
@ -87,7 +91,7 @@
|
||||
</select>
|
||||
|
||||
<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, bl_site_default_flag, 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, enterprise_name, enterprise_tax_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
from emis_customer_address a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -116,6 +120,8 @@
|
||||
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">bl_site_default_flag,</if>
|
||||
<if test="useSite != null and useSite != ''">use_site,</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">enterprise_tax_id,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@ -147,6 +153,8 @@
|
||||
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">#{blSiteDefaultFlag},</if>
|
||||
<if test="useSite != null and useSite != ''">#{useSite},</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">#{enterpriseTaxId},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@ -179,6 +187,8 @@
|
||||
<if test="blDefaultFlag != null and blDefaultFlag != ''">bl_default_flag = #{blDefaultFlag},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="blSiteDefaultFlag != null and blSiteDefaultFlag != ''">bl_site_default_flag = #{blSiteDefaultFlag},</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">enterprise_tax_id = #{enterpriseTaxId},</if>
|
||||
<if test="useSite != null and useSite != ''">use_site = #{useSite},</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
@ -237,6 +247,12 @@
|
||||
<if test="company != null and company != ''">and company = #{company}</if>
|
||||
<if test="company == null">and company is null</if>
|
||||
|
||||
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name = #{enterpriseName}</if>
|
||||
<if test="enterpriseName == null">and enterprise_name is null</if>
|
||||
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">and enterprise_tax_id = #{enterpriseTaxId}</if>
|
||||
<if test="enterpriseTaxId == null">and enterprise_tax_id is null</if>
|
||||
|
||||
and address_type = #{addressType}
|
||||
and customer_code is null
|
||||
</select>
|
||||
@ -266,5 +282,34 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkAndQuery" parameterType="EmisCustomerAddress" resultMap="EmisCustomerAddressResult">
|
||||
select * from emis_customer_address
|
||||
where del_flag='0'
|
||||
and country = #{country}
|
||||
and `name` = #{name}
|
||||
and phone = #{phone}
|
||||
and province = #{province}
|
||||
|
||||
</mapper>
|
||||
<if test="city != null and city != ''"> and city = #{city}</if>
|
||||
<if test="city == null">and city is null</if>
|
||||
|
||||
<if test="county != null and county != ''">and county = #{county}</if>
|
||||
<if test="county == null ">and county is null</if>
|
||||
|
||||
<if test="address != null and address != ''">and address = #{address}</if>
|
||||
<if test="address == null">and address is null</if>
|
||||
|
||||
<if test="company != null and company != ''">and company = #{company}</if>
|
||||
<if test="company == null">and company is null</if>
|
||||
|
||||
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name = #{enterpriseName}</if>
|
||||
<if test="enterpriseName == null">and enterprise_name is null</if>
|
||||
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">and enterprise_tax_id = #{enterpriseTaxId}</if>
|
||||
<if test="enterpriseTaxId == null">and enterprise_tax_id is null</if>
|
||||
|
||||
and address_type = #{addressType}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user