Merge pull request 'develop' (#212) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/212
This commit is contained in:
heyu 2025-10-28 17:49:31 +08:00
commit 35672cfe18
2 changed files with 39 additions and 0 deletions

View File

@ -3163,6 +3163,34 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
/**
* 校验运单号格式
* 只允许包含数字、字母、"-"横杠三种类型
* 横杠只允许在中间,不能在两端,且不能连续有多个横杠
* @param billCode 运单号
* @throws EmisBizError 格式不符合要求时抛出异常
*/
private void validateBillCodeFormat(String billCode) throws EmisBizError {
if (StringUtils.isEmpty(billCode)) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号不能为空");
}
// 检查是否只包含数字、字母、横杠
if (!billCode.matches("^[0-9a-zA-Z\\-]+$")) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号只能包含数字、字母和横杠");
}
// 检查横杠是否在两端
if (billCode.startsWith("-") || billCode.endsWith("-")) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号横杠不能在两端");
}
// 检查是否有连续的横杠
if (billCode.contains("--")) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号不能有连续的横杠");
}
}
/**
* 新开单
* @param emisWaybillSave
@ -3172,6 +3200,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 当寄件国家为0095或0855时,去除billCode和billCodeSub中的第一个T
// modifyBillCode(emisWaybillSave);
// 校验运单号格式
validateBillCodeFormat(emisWaybillSave.getBillCode());
// 获取运单号,判断是不是子单已存在
boolean isExists = checkWaybillIsExists(emisWaybillSave.getBillCode());
if(isExists){

View File

@ -167,6 +167,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
<!-- 过滤掉emis_waybill中bl_virtual='1'且master_bill_code有值的虚拟单 -->
and not exists(
select 1 from emis_waybill ew where a.bill_code=ew.bill_code and ew.bl_virtual='1' and ew.master_bill_code is not null and ew.master_bill_code != ''
)
<if test="params.sendSiteCode != null and params.sendSiteCode != ''">
and a.send_site_code = #{params.sendSiteCode}
@ -323,6 +327,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(173,170,151)
)
<!-- 过滤掉emis_waybill中bl_virtual='1'且master_bill_code有值的虚拟单 -->
and not exists(
select 1 from emis_waybill ew where a.bill_code=ew.bill_code and ew.bl_virtual='1' and ew.master_bill_code is not null and ew.master_bill_code != ''
)
<if test="params.sendSiteCode != null and params.sendSiteCode != ''">
and a.send_site_code = #{params.sendSiteCode}