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
e9406f71
Commit
e9406f71
authored
Aug 20, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善订单下单与编辑时当控货订单发货人设置了控货无收货人,对收货人信息的处理业务逻辑
parent
59e18dab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
273 additions
and
247 deletions
+273
-247
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+273
-247
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 @
e9406f71
...
@@ -519,7 +519,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -519,7 +519,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.
eq
(
CustomerContactsDO:
:
getPhoneNew
,
memberUserDO
.
getMobile
())
.
eq
(
CustomerContactsDO:
:
getPhoneNew
,
memberUserDO
.
getMobile
())
.
eq
(
CustomerContactsDO:
:
getAreaCode
,
memberUserDO
.
getAreaCode
())).
eq
(
CustomerContactsDO:
:
getDeleted
,
0
).
last
(
"limit 1"
));
.
eq
(
CustomerContactsDO:
:
getAreaCode
,
memberUserDO
.
getAreaCode
())).
eq
(
CustomerContactsDO:
:
getDeleted
,
0
).
last
(
"limit 1"
));
}
}
B
oolean
noConsignee
=
false
;
b
oolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
customerContacts
))
{
if
(
Objects
.
nonNull
(
customerContacts
))
{
//发货人联系人
//发货人联系人
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
...
@@ -692,6 +692,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -692,6 +692,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO
.
setUpdater
(
creator
);
orderConsignorDO
.
setUpdater
(
creator
);
CustomerDO
consignorDO
=
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
createReqVO
.
getConsignorId
());
customerService
.
getCustomer
(
createReqVO
.
getConsignorId
());
boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
consignorDO
))
{
if
(
Objects
.
nonNull
(
consignorDO
))
{
orderConsignorDO
.
setCompany
(
consignorDO
.
getCompany
());
orderConsignorDO
.
setCompany
(
consignorDO
.
getCompany
());
orderConsignorDO
.
setCompanyEn
(
consignorDO
.
getCompanyEn
());
orderConsignorDO
.
setCompanyEn
(
consignorDO
.
getCompanyEn
());
...
@@ -699,6 +700,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -699,6 +700,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
Objects
.
nonNull
(
consignorCountryDO
))
{
if
(
Objects
.
nonNull
(
consignorCountryDO
))
{
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
}
}
noConsignee
=
consignorDO
.
getNoConsignee
();
}
}
CustomerContactsDO
consignorContactsDO
=
CustomerContactsDO
consignorContactsDO
=
customerContactsService
.
getCustomerContacts
(
customerContactsService
.
getCustomerContacts
(
...
@@ -792,116 +794,117 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -792,116 +794,117 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO
.
getCountryCode
()
+
orderConsignorDO
.
getPhone
());
orderConsignorDO
.
getCountryCode
()
+
orderConsignorDO
.
getPhone
());
orderBusinessService
.
createOrderControlLog
(
orderCargoControlDO
.
getOrderId
(),
1
,
"创建控货信息"
,
msg
,
0L
);
orderBusinessService
.
createOrderControlLog
(
orderCargoControlDO
.
getOrderId
(),
1
,
"创建控货信息"
,
msg
,
0L
);
}
}
OrderConsigneeDO
orderConsigneeDO
=
null
;
if
(
order
.
getIsCargoControl
()
&&
!
noConsignee
)
{
OrderConsigneeDO
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
.
setOrderId
(
order
.
getOrderId
());
orderConsigneeDO
.
setOrderId
(
order
.
getOrderId
());
orderConsigneeDO
.
setCreator
(
creator
);
orderConsigneeDO
.
setCreator
(
creator
);
orderConsigneeDO
.
setUpdater
(
creator
);
orderConsigneeDO
.
setUpdater
(
creator
);
CustomerDO
consigneeDO
=
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
createReqVO
.
getConsigneeId
());
customerService
.
getCustomer
(
createReqVO
.
getConsigneeId
());
if
(
consigneeDO
!=
null
)
{
if
(
consigneeDO
!=
null
)
{
orderConsigneeDO
.
setCompany
(
consigneeDO
.
getCompany
());
orderConsigneeDO
.
setCompany
(
consigneeDO
.
getCompany
());
orderConsigneeDO
.
setCompanyEn
(
consigneeDO
.
getCompanyEn
());
orderConsigneeDO
.
setCompanyEn
(
consigneeDO
.
getCompanyEn
());
orderConsigneeDO
.
setAddress
(
consigneeDO
.
getAddress
());
orderConsigneeDO
.
setAddress
(
consigneeDO
.
getAddress
());
orderConsigneeDO
.
setCustomerId
(
consigneeDO
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigneeDO
.
getId
());
CountryDO
consigneeCountryDO
=
countryService
.
getById
(
consigneeDO
.
getCountry
());
CountryDO
consigneeCountryDO
=
countryService
.
getById
(
consigneeDO
.
getCountry
());
if
(
consigneeCountryDO
!=
null
)
{
if
(
consigneeCountryDO
!=
null
)
{
orderConsignorDO
.
setCountryAbbreviation
(
consigneeCountryDO
.
getNameShort
());
orderConsignorDO
.
setCountryAbbreviation
(
consigneeCountryDO
.
getNameShort
());
}
}
}
else
{
}
else
{
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
orderConsignorDO
.
setCountryAbbreviation
(
createReqVO
.
getCountryAbbreviation
());
orderConsignorDO
.
setCountryAbbreviation
(
createReqVO
.
getCountryAbbreviation
());
}
}
//客户联系人
//客户联系人
CustomerContactsDO
consigneeContactsDO
=
CustomerContactsDO
consigneeContactsDO
=
customerContactsService
.
getCustomerContacts
(
customerContactsService
.
getCustomerContacts
(
createReqVO
.
getConsigneeContactsId
());
createReqVO
.
getConsigneeContactsId
());
if
(
null
!=
consigneeContactsDO
)
{
if
(
null
!=
consigneeContactsDO
)
{
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getPhoneNew
()))
{
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getPhoneNew
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getAreaCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
orderConsigneeDO
.
setName
(
consigneeContactsDO
.
getName
());
orderConsigneeDO
.
setNameEn
(
consigneeContactsDO
.
getNameEn
());
orderConsigneeDO
.
setCountryCode
(
consigneeContactsDO
.
getAreaCode
());
orderConsigneeDO
.
setEmail
(
consigneeContactsDO
.
getEmail
());
orderConsigneeDO
.
setPhone
(
consigneeContactsDO
.
getPhoneNew
());
orderConsigneeDO
.
setCustomerContactsId
(
consigneeContactsDO
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigneeContactsDO
.
getCustomerId
());
}
else
{
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
}
if
(
StringUtils
.
isBlank
(
c
reateReqVO
.
getCountry
Code
()))
{
if
(
StringUtils
.
isBlank
(
c
onsigneeContactsDO
.
getArea
Code
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
}
orderConsigneeDO
.
setName
(
consigneeContactsDO
.
getName
());
orderConsigneeDO
.
setNameEn
(
consigneeContactsDO
.
getNameEn
());
orderConsigneeDO
.
setCountryCode
(
consigneeContactsDO
.
getAreaCode
());
orderConsigneeDO
.
setEmail
(
consigneeContactsDO
.
getEmail
());
orderConsigneeDO
.
setPhone
(
consigneeContactsDO
.
getPhoneNew
());
orderConsigneeDO
.
setCustomerContactsId
(
consigneeContactsDO
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigneeContactsDO
.
getCustomerId
());
}
else
{
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
createReqVO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
}
orderConsigneeDO
.
setName
(
createReqVO
.
getConsigneeName
());
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
}
}
orderConsigneeDO
.
setName
(
createReqVO
.
getConsigneeName
());
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
}
orderConsigneeDO
.
setHarvestMethod
(
createReqVO
.
getHarvestMethod
());
orderConsigneeDO
.
setHarvestMethod
(
createReqVO
.
getHarvestMethod
());
//收货方式
//收货方式
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeAddress
()))
{
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
orderConsigneeDO
.
setAddress
(
createReqVO
.
getConsigneeAddress
());
}
}
orderConsigneeDO
.
setCountry
(
createReqVO
.
getCountry
());
orderConsigneeDO
.
setCountry
(
createReqVO
.
getCountry
());
orderConsigneeDO
.
setProvince
(
createReqVO
.
getProvince
());
orderConsigneeDO
.
setProvince
(
createReqVO
.
getProvince
());
orderConsigneeDO
.
setCity
(
createReqVO
.
getCity
());
orderConsigneeDO
.
setCity
(
createReqVO
.
getCity
());
orderConsigneeDO
.
setRelationId
(
createReqVO
.
getUserId
());
orderConsigneeDO
.
setRelationId
(
createReqVO
.
getUserId
());
orderConsigneeDO
.
setCreateTime
(
now
);
orderConsigneeDO
.
setCreateTime
(
now
);
orderConsigneeDO
.
setUpdateTime
(
now
);
orderConsigneeDO
.
setUpdateTime
(
now
);
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
}
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
}
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
}
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
if
((
Objects
.
isNull
(
createReqVO
.
getIsCargoControl
())
||
!
createReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
dictDataRespDTO
.
getValue
(),
"11"
)
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
}
try
{
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
()))
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
orderConsigneeDO
.
setName
(
createReqVO
.
getConsigneeName
());
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
}
catch
(
Exception
e
)
{
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeNameEn
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeCompany
()))
{
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeCompanyEn
()))
{
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeEmail
()))
{
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
}
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeService
.
save
(
orderConsigneeDO
);
}
}
}
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
);
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
()))
{
orderConsigneeDO
.
setName
(
createReqVO
.
getConsigneeName
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeNameEn
()))
{
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeCompany
()))
{
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeCompanyEn
()))
{
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
}
if
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeEmail
()))
{
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
}
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeService
.
save
(
orderConsigneeDO
);
}
}
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
...
@@ -2889,6 +2892,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2889,6 +2892,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.
eq
(
CustomerContactsDO:
:
getAreaCode
,
memberUserDO
.
getAreaCode
())).
eq
(
CustomerContactsDO:
:
getDeleted
,
0
).
last
(
"limit 1"
));
.
eq
(
CustomerContactsDO:
:
getAreaCode
,
memberUserDO
.
getAreaCode
())).
eq
(
CustomerContactsDO:
:
getDeleted
,
0
).
last
(
"limit 1"
));
}
}
CustomerDO
consignorCustomerDO
=
null
;
CustomerDO
consignorCustomerDO
=
null
;
boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
customerContacts
))
{
if
(
Objects
.
nonNull
(
customerContacts
))
{
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
if
(
consignorCustomerDO
!=
null
)
{
if
(
consignorCustomerDO
!=
null
)
{
...
@@ -2898,6 +2902,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2898,6 +2902,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
consignorCountryDO
!=
null
)
{
if
(
consignorCountryDO
!=
null
)
{
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
}
}
noConsignee
=
consignorCustomerDO
.
getNoConsignee
();
}
}
if
(
StringUtils
.
isBlank
(
customerContacts
.
getPhoneNew
()))
{
if
(
StringUtils
.
isBlank
(
customerContacts
.
getPhoneNew
()))
{
throw
exception
(
CONSIGNOR_PHONE_NOT_NULL
);
throw
exception
(
CONSIGNOR_PHONE_NOT_NULL
);
...
@@ -2974,71 +2979,79 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2974,71 +2979,79 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
updateObj
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
updateObj
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
if
(
updateObj
.
getIsCargoControl
()
&&
!
noConsignee
)
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
}
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
.
setOrderId
(
updateObj
.
getOrderId
());
}
orderConsigneeDO
.
setCreator
(
updater
);
orderConsigneeDO
.
setOrderId
(
updateObj
.
getOrderId
());
orderConsigneeDO
.
setUpdater
(
updater
);
orderConsigneeDO
.
setCreator
(
updater
);
orderConsigneeDO
.
setUpdater
(
updater
);
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneePhone
()))
{
}
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getCountryCode
()))
{
}
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getCountryCode
()))
{
}
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
orderConsigneeDO
.
setPhone
(
updateReqVO
.
getConsigneePhone
());
}
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeName
())
?
updateReqVO
.
getConsigneeName
()
:
updateReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setPhone
(
updateReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setNameEn
(
Objects
.
isNull
(
updateReqVO
.
getConsigneeNameEn
())
?
""
:
updateReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeName
())
?
updateReqVO
.
getConsigneeName
()
:
updateReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setCountryCode
(
updateReqVO
.
getCountryCode
());
orderConsigneeDO
.
setNameEn
(
Objects
.
isNull
(
updateReqVO
.
getConsigneeNameEn
())
?
""
:
updateReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCountryCode
(
updateReqVO
.
getCountryCode
());
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setHarvestMethod
(
updateReqVO
.
getHarvestMethod
());
// 收货方式
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setHarvestMethod
(
updateReqVO
.
getHarvestMethod
());
// 收货方式
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeAddress
()))
{
}
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
orderConsigneeDO
.
setCountry
(
updateReqVO
.
getCountry
());
}
orderConsigneeDO
.
setProvince
(
updateReqVO
.
getProvince
());
orderConsigneeDO
.
setCountry
(
updateReqVO
.
getCountry
());
orderConsigneeDO
.
setCity
(
updateReqVO
.
getCity
());
orderConsigneeDO
.
setProvince
(
updateReqVO
.
getProvince
());
orderConsigneeDO
.
setRelationId
(
updateReqVO
.
getUserId
());
orderConsigneeDO
.
setCity
(
updateReqVO
.
getCity
());
orderConsigneeDO
.
setCreateTime
(
now
);
orderConsigneeDO
.
setRelationId
(
updateReqVO
.
getUserId
());
orderConsigneeDO
.
setUpdateTime
(
now
);
orderConsigneeDO
.
setCreateTime
(
now
);
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
orderConsigneeDO
.
setUpdateTime
(
now
);
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
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
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
}
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
if
((
Objects
.
isNull
(
updateReqVO
.
getIsCargoControl
())
||
!
updateReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
}
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
"11"
,
dictDataRespDTO
.
getValue
())
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
if
((
Objects
.
isNull
(
updateReqVO
.
getIsCargoControl
())
||
!
updateReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
"11"
,
dictDataRespDTO
.
getValue
())
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
}
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
try
{
}
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
try
{
paramValidatorService
.
validatorMobile
(
mobileCode
);
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
}
catch
(
Exception
e
)
{
paramValidatorService
.
validatorMobile
(
mobileCode
);
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
catch
(
Exception
e
)
{
}
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
}
CustomerContactsDO
consignee
=
customerContactsService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
if
(
Objects
.
nonNull
(
consignee
)
&&
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
CustomerContactsDO
consignee
=
customerContactsService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
if
(
Objects
.
nonNull
(
consignee
)
&&
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
}
else
{
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
}
else
{
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
if
(
consignorCustomerDO
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
CustomerContactsDO
consigeeCustomer
=
customerService
.
createConsigeeCustomer
(
orderConsigneeDO
.
getName
(),
if
(
consignorCustomerDO
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getEmail
(),
consignorCustomerDO
,
updateObj
.
getOrderNo
());
CustomerContactsDO
consigeeCustomer
=
customerService
.
createConsigeeCustomer
(
orderConsigneeDO
.
getName
(),
if
(
consigeeCustomer
!=
null
)
{
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getEmail
(),
consignorCustomerDO
,
updateObj
.
getOrderNo
());
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
if
(
consigeeCustomer
!=
null
)
{
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
}
}
}
}
}
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
}
else
{
// 如果控货订单发货人设置了控货无收货人,则需要删除订单已有收货人
if
(
Objects
.
nonNull
(
orderConsigneeDO
)){
orderConsigneeService
.
removeById
(
orderConsigneeDO
.
getId
());
orderConsigneeDO
=
null
;
}
}
}
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
...
@@ -3072,11 +3085,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3072,11 +3085,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
Objects
.
isNull
(
orderConsignorDO
))
{
if
(
Objects
.
isNull
(
orderConsignorDO
))
{
orderConsignorDO
=
new
OrderConsignorDO
();
orderConsignorDO
=
new
OrderConsignorDO
();
}
}
boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
consignorDO
))
{
if
(
Objects
.
nonNull
(
consignorDO
))
{
orderConsignorDO
.
setCompany
(
consignorDO
.
getCompany
());
orderConsignorDO
.
setCompany
(
consignorDO
.
getCompany
());
orderConsignorDO
.
setCompanyEn
(
consignorDO
.
getCompanyEn
());
orderConsignorDO
.
setCompanyEn
(
consignorDO
.
getCompanyEn
());
CountryDO
consignorCountryDO
=
countryService
.
getById
(
consignorDO
.
getCountry
());
CountryDO
consignorCountryDO
=
countryService
.
getById
(
consignorDO
.
getCountry
());
orderConsignorDO
.
setCountryAbbreviation
(
Objects
.
isNull
(
consignorCountryDO
)
?
null
:
consignorCountryDO
.
getNameShort
());
orderConsignorDO
.
setCountryAbbreviation
(
Objects
.
isNull
(
consignorCountryDO
)
?
null
:
consignorCountryDO
.
getNameShort
());
noConsignee
=
consignorDO
.
getNoConsignee
();
}
}
if
(
Objects
.
nonNull
(
consignorContactsDO
))
{
if
(
Objects
.
nonNull
(
consignorContactsDO
))
{
...
@@ -3181,102 +3196,113 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3181,102 +3196,113 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
updateReqVO
.
getConsigneeId
());
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
updateReqVO
.
getConsigneeId
());
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
updateObj
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
updateObj
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
if
(
updateObj
.
getIsCargoControl
()
&&
!
noConsignee
)
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
=
new
OrderConsigneeDO
();
}
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
if
(
consigneeDO
!=
null
)
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
.
setCompany
(
consigneeDO
.
getCompany
());
}
orderConsigneeDO
.
setCompanyEn
(
consigneeDO
.
getCompanyEn
());
if
(
consigneeDO
!=
null
)
{
orderConsigneeDO
.
setAddress
(
consigneeDO
.
getAddress
());
orderConsigneeDO
.
setCompany
(
consigneeDO
.
getCompany
());
CountryDO
consigneeCountryDO
=
countryService
.
getById
(
consigneeDO
.
getCountry
());
orderConsigneeDO
.
setCompanyEn
(
consigneeDO
.
getCompanyEn
());
if
(
consigneeCountryDO
!=
null
)
{
orderConsigneeDO
.
setAddress
(
consigneeDO
.
getAddress
());
orderConsignorDO
.
setCountryAbbreviation
(
consigneeCountryDO
.
getNameShort
());
CountryDO
consigneeCountryDO
=
countryService
.
getById
(
consigneeDO
.
getCountry
());
}
if
(
consigneeCountryDO
!=
null
)
{
}
else
{
orderConsignorDO
.
setCountryAbbreviation
(
consigneeCountryDO
.
getNameShort
());
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
}
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
}
else
{
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
orderConsignorDO
.
setCountryAbbreviation
(
updateReqVO
.
getCountryAbbreviation
());
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
}
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
CustomerContactsDO
consigneeContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsigneeContactsId
());
orderConsignorDO
.
setCountryAbbreviation
(
updateReqVO
.
getCountryAbbreviation
());
if
(
null
!=
consigneeContactsDO
)
{
}
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getPhoneNew
()))
{
CustomerContactsDO
consigneeContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsigneeContactsId
());
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
if
(
null
!=
consigneeContactsDO
)
{
}
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getPhoneNew
()))
{
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getAreaCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
orderConsigneeDO
.
setName
(
consigneeContactsDO
.
getName
());
orderConsigneeDO
.
setNameEn
(
consigneeContactsDO
.
getNameEn
());
orderConsigneeDO
.
setCountryCode
(
consigneeContactsDO
.
getAreaCode
());
orderConsigneeDO
.
setEmail
(
consigneeContactsDO
.
getEmail
());
orderConsigneeDO
.
setPhone
(
consigneeContactsDO
.
getPhoneNew
());
orderConsigneeDO
.
setCustomerContactsId
(
consigneeContactsDO
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigneeContactsDO
.
getCustomerId
());
}
else
{
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
}
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getCountryCode
())
&&
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneeCountry
Code
()))
{
if
(
StringUtils
.
isBlank
(
consigneeContactsDO
.
getArea
Code
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
}
orderConsigneeDO
.
setName
(
consigneeContactsDO
.
getName
());
orderConsigneeDO
.
setNameEn
(
consigneeContactsDO
.
getNameEn
());
orderConsigneeDO
.
setCountryCode
(
consigneeContactsDO
.
getAreaCode
());
orderConsigneeDO
.
setEmail
(
consigneeContactsDO
.
getEmail
());
orderConsigneeDO
.
setPhone
(
consigneeContactsDO
.
getPhoneNew
());
orderConsigneeDO
.
setCustomerContactsId
(
consigneeContactsDO
.
getId
());
orderConsigneeDO
.
setCustomerId
(
consigneeContactsDO
.
getCustomerId
());
}
else
{
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneePhone
()))
{
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getCountryCode
())
&&
StringUtils
.
isBlank
(
updateReqVO
.
getConsigneeCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
}
}
orderConsigneeDO
.
setCustomerContactsId
(
updateReqVO
.
getConsigneeContactsId
());
orderConsigneeDO
.
setCustomerId
(
updateReqVO
.
getConsigneeId
());
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
());
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
Objects
.
nonNull
(
updateReqVO
.
getCountryCode
())
?
updateReqVO
.
getCountryCode
()
:
updateReqVO
.
getConsigneeCountryCode
());
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setPhone
(
updateReqVO
.
getConsigneePhone
());
}
if
((
Objects
.
isNull
(
updateReqVO
.
getIsCargoControl
())
||
!
updateReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
"11"
,
dictDataRespDTO
.
getValue
())
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
}
orderConsigneeDO
.
setCustomerContactsId
(
updateReqVO
.
getConsigneeContactsId
());
orderConsigneeDO
.
setHarvestMethod
(
updateReqVO
.
getHarvestMethod
());
// 收货方式
orderConsigneeDO
.
setCustomerId
(
updateReqVO
.
getConsigneeId
());
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
());
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
());
}
orderConsigneeDO
.
setCountryCode
(
Objects
.
nonNull
(
updateReqVO
.
getCountryCode
())
?
updateReqVO
.
getCountryCode
()
:
updateReqVO
.
getConsigneeCountryCode
());
orderConsigneeDO
.
setOrderId
(
updateObj
.
getOrderId
());
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setUpdater
(
updater
);
orderConsigneeDO
.
setPhone
(
updateReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setCountry
(
updateReqVO
.
getCountry
());
}
orderConsigneeDO
.
setProvince
(
updateReqVO
.
getProvince
());
if
((
Objects
.
isNull
(
updateReqVO
.
getIsCargoControl
())
||
!
updateReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
orderConsigneeDO
.
setCity
(
updateReqVO
.
getCity
());
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
"11"
,
dictDataRespDTO
.
getValue
())
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
orderConsigneeDO
.
setRelationId
(
updateReqVO
.
getCustomerId
());
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
orderConsigneeDO
.
setHarvestMethod
(
updateReqVO
.
getHarvestMethod
());
// 收货方式
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeAddress
()))
{
orderConsigneeDO
.
setAddress
(
updateReqVO
.
getConsigneeAddress
());
}
orderConsigneeDO
.
setOrderId
(
updateObj
.
getOrderId
());
orderConsigneeDO
.
setUpdater
(
updater
);
orderConsigneeDO
.
setCountry
(
updateReqVO
.
getCountry
());
orderConsigneeDO
.
setProvince
(
updateReqVO
.
getProvince
());
orderConsigneeDO
.
setCity
(
updateReqVO
.
getCity
());
orderConsigneeDO
.
setRelationId
(
updateReqVO
.
getCustomerId
());
orderConsigneeDO
.
setUpdateTime
(
now
);
orderConsigneeDO
.
setUpdateTime
(
now
);
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
}
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
}
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
}
if
(
StringUtils
.
is
Blank
(
orderConsigneeDO
.
get
Name
()))
{
if
(
StringUtils
.
is
NotBlank
(
updateReqVO
.
getConsignee
Name
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
()
);
}
}
try
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeNameEn
()))
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
());
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompany
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeName
()))
{
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
());
}
}
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompanyEn
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeNameEn
()))
{
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
());
}
}
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeEmail
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompany
()))
{
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
}
}
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompanyEn
()))
{
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
}
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeEmail
()))
{
// 如果控货订单发货人设置了控货无收货人,则需要删除订单已有收货人
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
if
(
Objects
.
nonNull
(
orderConsigneeDO
)){
}
orderConsigneeService
.
removeById
(
orderConsigneeDO
.
getId
());
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeDO
=
null
;
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
}
consigneeDO
=
null
;
}
}
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
...
...
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