Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
59e18dab
Commit
59e18dab
authored
Aug 20, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web-app下单对收货人校验规则的修改
parent
910207c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
73 deletions
+78
-73
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+78
-73
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderServiceImpl.java
View file @
59e18dab
...
...
@@ -519,6 +519,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.
eq
(
CustomerContactsDO:
:
getPhoneNew
,
memberUserDO
.
getMobile
())
.
eq
(
CustomerContactsDO:
:
getAreaCode
,
memberUserDO
.
getAreaCode
())).
eq
(
CustomerContactsDO:
:
getDeleted
,
0
).
last
(
"limit 1"
));
}
Boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
customerContacts
))
{
//发货人联系人
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
...
...
@@ -529,6 +530,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
consignorCountryDO
!=
null
)
{
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
}
noConsignee
=
Objects
.
nonNull
(
consignorCustomerDO
.
getNoConsignee
())
&&
consignorCustomerDO
.
getNoConsignee
();
}
if
(
StringUtils
.
isBlank
(
customerContacts
.
getPhoneNew
()))
{
throw
exception
(
CONSIGNOR_PHONE_NOT_NULL
);
...
...
@@ -584,86 +586,89 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderCargoControlDO
.
setIsActual
(
Boolean
.
TRUE
);
orderCargoControlMapper
.
insert
(
orderCargoControlDO
);
}
OrderConsigneeDO
orderConsigneeDO
=
null
;
// 当订单为控货订单,且发货人客户档案未设置控货无收货人,则需要校验收货人信息
if
(
order
.
getIsCargoControl
()
&&
!
noConsignee
)
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
.
setOrderId
(
order
.
getOrderId
());
orderConsigneeDO
.
setCreator
(
creator
);
orderConsigneeDO
.
setUpdater
(
creator
);
OrderConsigneeDO
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
.
setOrderId
(
order
.
getOrderId
());
orderConsigneeDO
.
setCreator
(
creator
);
orderConsigneeDO
.
setUpdater
(
creator
);
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
createReqVO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
())
?
createReqVO
.
getConsigneeName
()
:
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
createReqVO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
())
?
createReqVO
.
getConsigneeName
()
:
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setHarvestMethod
(
createReqVO
.
getHarvestMethod
());
// 收货方式
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
}
orderConsigneeDO
.
setCountry
(
createReqVO
.
getCountry
());
orderConsigneeDO
.
setProvince
(
createReqVO
.
getProvince
());
orderConsigneeDO
.
setCity
(
createReqVO
.
getCity
());
orderConsigneeDO
.
setRelationId
(
createReqVO
.
getUserId
());
orderConsigneeDO
.
setCreateTime
(
now
);
orderConsigneeDO
.
setUpdateTime
(
now
);
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
}
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
}
if
((
Objects
.
isNull
(
createReqVO
.
getIsCargoControl
())
||
!
createReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
dictDataRespDTO
.
getValue
(),
"11"
)
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
CustomerContactsDO
consignee
=
customerService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
orderConsigneeDO
.
setHarvestMethod
(
createReqVO
.
getHarvestMethod
());
// 收货方式
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
}
orderConsigneeDO
.
setCountry
(
createReqVO
.
getCountry
());
orderConsigneeDO
.
setProvince
(
createReqVO
.
getProvince
());
orderConsigneeDO
.
setCity
(
createReqVO
.
getCity
());
orderConsigneeDO
.
setRelationId
(
createReqVO
.
getUserId
());
orderConsigneeDO
.
setCreateTime
(
now
);
orderConsigneeDO
.
setUpdateTime
(
now
);
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
}
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
}
if
((
Objects
.
isNull
(
createReqVO
.
getIsCargoControl
())
||
!
createReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
dictDataRespDTO
.
getValue
(),
"11"
)
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
CustomerContactsDO
consignee
=
customerService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
if
(
Objects
.
nonNull
(
consignee
)
&&
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
if
(
Objects
.
nonNull
(
consignee
)
&&
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
}
else
{
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if
(
consignorCustomerDO
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
//ecw_customer_contacts 客户联系人
//创建收货人客户
CustomerContactsDO
consigeeCustomer
=
customerService
.
createConsigeeCustomer
(
orderConsigneeDO
.
getName
(),
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getEmail
(),
consignorCustomerDO
,
order
.
getOrderNo
());
if
(
consigeeCustomer
!=
null
)
{
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
}
else
{
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if
(
consignorCustomerDO
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
//ecw_customer_contacts 客户联系人
//创建收货人客户
CustomerContactsDO
consigeeCustomer
=
customerService
.
createConsigeeCustomer
(
orderConsigneeDO
.
getName
(),
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getEmail
(),
consignorCustomerDO
,
order
.
getOrderNo
());
if
(
consigeeCustomer
!=
null
)
{
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
}
}
}
orderConsigneeService
.
save
(
orderConsigneeDO
);
}
orderConsigneeService
.
save
(
orderConsigneeDO
);
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
//customerType 发货人-1 收货人 2
int
customerType
=
this
.
checkOrderSalesman
(
order
,
createReqVO
.
getOfferId
(),
null
,
null
,
orderConsignorDO
,
orderConsigneeDO
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment