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
c1b53931
Commit
c1b53931
authored
Aug 21, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'order-update' into dev
parents
102847c5
555bc7f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
403 additions
and
341 deletions
+403
-341
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+401
-341
OrderBackVO.java
...a/cn/iocoder/yudao/module/order/vo/order/OrderBackVO.java
+2
-0
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 @
c1b53931
...
@@ -519,6 +519,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -519,6 +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"
));
}
}
boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
customerContacts
))
{
if
(
Objects
.
nonNull
(
customerContacts
))
{
//发货人联系人
//发货人联系人
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
consignorCustomerDO
=
customerService
.
getCustomer
(
customerContacts
.
getCustomerId
());
...
@@ -529,6 +530,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -529,6 +530,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
consignorCountryDO
!=
null
)
{
if
(
consignorCountryDO
!=
null
)
{
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
orderConsignorDO
.
setCountryAbbreviation
(
consignorCountryDO
.
getNameShort
());
}
}
noConsignee
=
Objects
.
nonNull
(
consignorCustomerDO
.
getNoConsignee
())
&&
consignorCustomerDO
.
getNoConsignee
();
}
}
if
(
StringUtils
.
isBlank
(
customerContacts
.
getPhoneNew
()))
{
if
(
StringUtils
.
isBlank
(
customerContacts
.
getPhoneNew
()))
{
throw
exception
(
CONSIGNOR_PHONE_NOT_NULL
);
throw
exception
(
CONSIGNOR_PHONE_NOT_NULL
);
...
@@ -584,86 +586,89 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -584,86 +586,89 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderCargoControlDO
.
setIsActual
(
Boolean
.
TRUE
);
orderCargoControlDO
.
setIsActual
(
Boolean
.
TRUE
);
orderCargoControlMapper
.
insert
(
orderCargoControlDO
);
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
();
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
orderConsigneeDO
.
setOrderId
(
order
.
getOrderId
());
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
orderConsigneeDO
.
setCreator
(
creator
);
}
orderConsigneeDO
.
setUpdater
(
creator
);
if
(
StringUtils
.
isBlank
(
createReqVO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
if
(
StringUtils
.
isBlank
(
createReqVO
.
getConsigneePhone
()))
{
}
throw
exception
(
CONSIGNEE_PHONE_NOT_NULL
);
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
}
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
())
?
createReqVO
.
getConsigneeName
()
:
createReqVO
.
getConsigneePhone
());
if
(
StringUtils
.
isBlank
(
createReqVO
.
getCountryCode
()))
{
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
throw
exception
(
CONSIGNEE_PHONE_CODE_NOT_NULL
);
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
}
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setPhone
(
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setName
(
StringUtils
.
isNotBlank
(
createReqVO
.
getConsigneeName
())
?
createReqVO
.
getConsigneeName
()
:
createReqVO
.
getConsigneePhone
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setNameEn
(
createReqVO
.
getConsigneeNameEn
());
orderConsigneeDO
.
setCountryCode
(
createReqVO
.
getCountryCode
());
orderConsigneeDO
.
setEmail
(
createReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setCompany
(
createReqVO
.
getConsigneeCompany
());
orderConsigneeDO
.
setCompanyEn
(
createReqVO
.
getConsigneeCompanyEn
());
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
(
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
()))
{
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getName
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
}
}
if
((
Objects
.
isNull
(
createReqVO
.
getIsCargoControl
())
||
!
createReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
if
((
Objects
.
isNull
(
createReqVO
.
getIsCargoControl
())
||
!
createReqVO
.
getIsCargoControl
())
&&
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getCountryCode
())
&&
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
dictDataRespDTO
.
getValue
(),
"11"
)
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
Objects
.
nonNull
(
dictDataRespDTO
)
&&
StringUtils
.
equals
(
dictDataRespDTO
.
getValue
(),
"11"
)
&&
StringUtils
.
equals
(
"86"
,
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
throw
exception
(
CONSIGNEE_PHONE_IS_EXTERNAL
);
}
}
try
{
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
CustomerContactsDO
consignee
=
customerService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
CustomerContactsDO
consignee
=
customerService
.
getUniqueOneAndValidate
(
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
null
);
if
(
Objects
.
nonNull
(
consignee
)
&&
if
(
Objects
.
nonNull
(
consignee
)
&&
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
Objects
.
nonNull
(
consignee
.
getCustomerId
()))
{
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
orderConsigneeDO
.
setCustomerId
(
consignee
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
orderConsigneeDO
.
setCustomerContactsId
(
consignee
.
getId
());
}
else
{
}
else
{
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if
(
consignorCustomerDO
==
null
||
if
(
consignorCustomerDO
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
null
||
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
consignorCustomerDO
.
getCustomerService
()
==
0
)
{
//ecw_customer_contacts 客户联系人
//ecw_customer_contacts 客户联系人
//创建收货人客户
//创建收货人客户
CustomerContactsDO
consigeeCustomer
=
CustomerContactsDO
consigeeCustomer
=
customerService
.
createConsigeeCustomer
(
customerService
.
createConsigeeCustomer
(
orderConsigneeDO
.
getName
(),
orderConsigneeDO
.
getName
(),
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getCountryCode
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getPhone
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getCompany
(),
orderConsigneeDO
.
getEmail
(),
orderConsigneeDO
.
getEmail
(),
consignorCustomerDO
,
consignorCustomerDO
,
order
.
getOrderNo
());
order
.
getOrderNo
());
if
(
consigeeCustomer
!=
null
)
{
if
(
consigeeCustomer
!=
null
)
{
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
orderConsigneeDO
.
setCustomerId
(
consigeeCustomer
.
getCustomerId
());
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
orderConsigneeDO
.
setCustomerContactsId
(
consigeeCustomer
.
getId
());
}
}
}
}
}
orderConsigneeService
.
save
(
orderConsigneeDO
);
}
}
orderConsigneeService
.
save
(
orderConsigneeDO
);
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
//customerType 发货人-1 收货人 2
//customerType 发货人-1 收货人 2
int
customerType
=
this
.
checkOrderSalesman
(
order
,
createReqVO
.
getOfferId
(),
null
,
null
,
orderConsignorDO
,
orderConsigneeDO
);
int
customerType
=
this
.
checkOrderSalesman
(
order
,
createReqVO
.
getOfferId
(),
null
,
null
,
orderConsignorDO
,
orderConsigneeDO
);
...
@@ -687,6 +692,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -687,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
());
...
@@ -694,6 +700,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -694,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
(
...
@@ -787,116 +794,117 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -787,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
()))
{
...
@@ -1807,33 +1815,57 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -1807,33 +1815,57 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerContactsDO
consignorContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsignorContactsId
());
CustomerContactsDO
consignorContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsignorContactsId
());
OrderConsignorBackVO
orderConsignorBackVO
=
vo
.
getConsignorVO
();
OrderConsignorBackVO
orderConsignorBackVO
=
vo
.
getConsignorVO
();
CustomerDO
consignorDO
=
null
;
CustomerDO
consignorDO
=
null
;
boolean
noConsignee
=
false
;
if
(
Objects
.
nonNull
(
consignorContactsDO
))
{
if
(
Objects
.
nonNull
(
consignorContactsDO
))
{
consignorDO
=
customerService
.
getById
(
updateReqVO
.
getConsignorId
());
consignorDO
=
customerService
.
getById
(
consignorContactsDO
.
getCustomerId
());
if
(
Objects
.
nonNull
(
consignorDO
))
{
noConsignee
=
consignorDO
.
getNoConsignee
();
if
(
vo
.
getIsCargoControl
()
&&
vo
.
getHasConsignee
()
!=
noConsignee
)
{
ApplyInfoVO
infoVO
=
new
ApplyInfoVO
();
infoVO
.
setName
(
"控货订单发货人控货无收货人"
);
infoVO
.
setOrgValue
(
vo
.
getHasConsignee
()?
"是"
:
"否"
);
infoVO
.
setNewValue
(
noConsignee
?
"是"
:
"否"
);
vo
.
setHasConsignee
(
noConsignee
);
applyInfoList
.
add
(
infoVO
);
// 发货人控货无收货人属性设置变动,需要变动客户业绩
vo
.
setIsCharge
(
true
);
}
}
this
.
compareConsignorInfo
(
updateReqVO
,
consignorContactsDO
,
orderConsignorBackVO
,
applyInfoList
,
vo
);
this
.
compareConsignorInfo
(
updateReqVO
,
consignorContactsDO
,
orderConsignorBackVO
,
applyInfoList
,
vo
);
}
}
vo
.
setConsignorVO
(
orderConsignorBackVO
);
vo
.
setConsignorVO
(
orderConsignorBackVO
);
// 比较收货人信息
// 比较收货人信息
CustomerContactsDO
consigneeContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsigneeContactsId
());
CustomerContactsDO
consigneeContactsDO
=
customerContactsService
.
getCustomerContacts
(
updateReqVO
.
getConsigneeContactsId
());
OrderConsigneeBackVO
orderConsigneeBackVO
=
vo
.
getConsigneeVO
();
OrderConsigneeBackVO
orderConsigneeBackVO
=
vo
.
getConsigneeVO
();
CustomerDO
consigneeDO
=
customerService
.
getById
(
updateReqVO
.
getConsignorId
());
CustomerDO
consigneeDO
=
customerService
.
getById
(
updateReqVO
.
getConsigneeId
());
if
(
Objects
.
isNull
(
consigneeContactsDO
))
{
if
(
vo
.
getIsCargoControl
()
&&
!
noConsignee
)
{
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
if
(
Objects
.
isNull
(
consigneeContactsDO
))
{
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
// consigneeDO = customerService.getById(updateReqVO.getConsignorId());
// consigneeDO = customerService.getById(updateReqVO.getConsignorId());
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if
(
consigneeDO
==
null
||
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
)
{
if
(
consigneeDO
==
null
||
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
)
{
consigneeContactsDO
=
customerService
.
createConsigeeCustomer
(
consigneeContactsDO
=
customerService
.
createConsigeeCustomer
(
orderConsigneeBackVO
.
getName
(),
orderConsigneeBackVO
.
getName
(),
orderConsigneeBackVO
.
getCountryCode
(),
orderConsigneeBackVO
.
getCountryCode
(),
orderConsigneeBackVO
.
getPhone
(),
orderConsigneeBackVO
.
getPhone
(),
orderConsigneeBackVO
.
getCompany
(),
orderConsigneeBackVO
.
getCompany
(),
orderConsigneeBackVO
.
getEmail
(),
orderConsigneeBackVO
.
getEmail
(),
consigneeDO
,
vo
.
getOrderNo
());
consigneeDO
,
vo
.
getOrderNo
());
}
}
}
}
if
(
Objects
.
nonNull
(
consigneeContactsDO
))
{
if
(
Objects
.
nonNull
(
consigneeContactsDO
))
{
this
.
compareConsigneeInfo
(
updateReqVO
,
consigneeContactsDO
,
orderConsigneeBackVO
,
applyInfoList
,
vo
,
dictDataRespDTO
);
this
.
compareConsigneeInfo
(
updateReqVO
,
consigneeContactsDO
,
orderConsigneeBackVO
,
applyInfoList
,
vo
,
dictDataRespDTO
);
}
}
else
{
// 控货订单发货人设置为控货无收货人,这里需要处理掉订单的收货人信息
if
(
Objects
.
nonNull
(
orderConsigneeBackVO
)){
ApplyInfoVO
infoVO
=
new
ApplyInfoVO
();
infoVO
.
setName
(
"控货订单发货人设置为控货无收货人,清除订单收货人信息/Set the shipper of the controlled goods order to no consignee, and clear the consignee information of the order"
);
applyInfoList
.
add
(
infoVO
);
vo
.
setIsChargeNoConsignee
(
true
);
}
}
}
if
(
vo
.
getIsCharge
()
||
orderConsignorBackVO
.
getIsCharge
()
||
if
(
vo
.
getIsCharge
()
||
orderConsignorBackVO
.
getIsCharge
()
||
orderConsigneeBackVO
.
getIsCharge
())
{
orderConsigneeBackVO
.
getIsCharge
())
{
...
@@ -2610,7 +2642,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2610,7 +2642,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
infoVO
.
setNewValue
(
updateReqVO
.
getIsCargoControl
()
?
"是/yes"
:
"否/no"
);
infoVO
.
setNewValue
(
updateReqVO
.
getIsCargoControl
()
?
"是/yes"
:
"否/no"
);
vo
.
setIsCargoControl
(
updateReqVO
.
getIsCargoControl
());
vo
.
setIsCargoControl
(
updateReqVO
.
getIsCargoControl
());
applyInfoList
.
add
(
infoVO
);
applyInfoList
.
add
(
infoVO
);
// vo.setIsCharge(true);
}
}
Map
<
Integer
,
CurrencyRespDTO
>
currencyMap
=
currencyApi
.
getAllCurrency
();
Map
<
Integer
,
CurrencyRespDTO
>
currencyMap
=
currencyApi
.
getAllCurrency
();
CurrencyRespDTO
orgCurrencyRespDTO
=
currencyMap
.
get
(
vo
.
getCollectionProxyCurrency
());
CurrencyRespDTO
orgCurrencyRespDTO
=
currencyMap
.
get
(
vo
.
getCollectionProxyCurrency
());
...
@@ -2884,6 +2915,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2884,6 +2915,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
)
{
...
@@ -2893,6 +2925,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2893,6 +2925,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
);
...
@@ -2969,71 +3002,79 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2969,71 +3002,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
()))
{
...
@@ -3067,11 +3108,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3067,11 +3108,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
))
{
...
@@ -3176,102 +3219,113 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3176,102 +3219,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
.
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
);
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
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
);
}
try
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
}
orderConsigneeDO
.
setCustomerContactsId
(
updateReqVO
.
getConsigneeContactsId
());
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeName
()))
{
orderConsigneeDO
.
setCustomerId
(
updateReqVO
.
getConsigneeId
());
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
());
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
.
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
);
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
if
(
StringUtils
.
isBlank
(
orderConsigneeDO
.
getPhone
())
||
StringUtils
.
isBlank
(
orderConsigneeDO
.
getCountryCode
()))
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE
);
}
}
if
(
StringUtils
.
is
Blank
(
orderConsigneeDO
.
getName
()))
{
if
(
StringUtils
.
is
NotBlank
(
updateReqVO
.
getConsigneeNameEn
()))
{
throw
exception
(
ORDER_CONSIGNEE_NAME_NOT_COMPLETE
);
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
()
);
}
}
try
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompany
()))
{
String
mobileCode
=
orderConsigneeDO
.
getCountryCode
()
+
StrUtil
.
COLON
+
orderConsigneeDO
.
getPhone
();
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
paramValidatorService
.
validatorMobile
(
mobileCode
);
}
catch
(
Exception
e
)
{
throw
exception
(
ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompanyEn
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeName
()))
{
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
orderConsigneeDO
.
setName
(
updateReqVO
.
getConsigneeName
());
}
}
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeEmail
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeNameEn
()))
{
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
orderConsigneeDO
.
setNameEn
(
updateReqVO
.
getConsigneeNameEn
());
}
}
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompany
()))
{
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
orderConsigneeDO
.
setCompany
(
updateReqVO
.
getConsigneeCompany
());
}
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeCompanyEn
()))
{
// 如果控货订单发货人设置了控货无收货人,则需要删除订单已有收货人
orderConsigneeDO
.
setCompanyEn
(
updateReqVO
.
getConsigneeCompanyEn
());
if
(
Objects
.
nonNull
(
orderConsigneeDO
)){
}
orderConsigneeService
.
removeById
(
orderConsigneeDO
.
getId
());
if
(
StringUtils
.
isNotBlank
(
updateReqVO
.
getConsigneeEmail
()))
{
orderConsigneeDO
=
null
;
orderConsigneeDO
.
setEmail
(
updateReqVO
.
getConsigneeEmail
());
}
}
consigneeDO
=
null
;
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
}
}
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
...
@@ -5372,7 +5426,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -5372,7 +5426,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO
consignorDO
=
OrderConsignorConvert
.
INSTANCE
.
convert
(
consignorVO
);
OrderConsignorDO
consignorDO
=
OrderConsignorConvert
.
INSTANCE
.
convert
(
consignorVO
);
orderConsignorService
.
updateById
(
consignorDO
);
orderConsignorService
.
updateById
(
consignorDO
);
OrderConsigneeDO
consigneeDO
=
OrderConsigneeConvert
.
INSTANCE
.
convert
(
consigneeVO
);
OrderConsigneeDO
consigneeDO
=
OrderConsigneeConvert
.
INSTANCE
.
convert
(
consigneeVO
);
orderConsigneeService
.
updateById
(
consigneeDO
);
// 控货订单发货人无收货人属性变动,需要清空订单收货人信息
if
(
orderBackVO
.
getIsChargeNoConsignee
()){
orderConsigneeService
.
removeById
(
consigneeDO
.
getId
());
}
else
{
orderConsigneeService
.
updateById
(
consigneeDO
);
}
// 始发地目的地更新
// 始发地目的地更新
OrderDepartureDO
departureDO
=
OrderDepartureConvert
.
INSTANCE
.
convert
(
orderBackVO
.
getOrderDepartureVO
());
OrderDepartureDO
departureDO
=
OrderDepartureConvert
.
INSTANCE
.
convert
(
orderBackVO
.
getOrderDepartureVO
());
orderDepartureService
.
updateById
(
departureDO
);
orderDepartureService
.
updateById
(
departureDO
);
...
@@ -5579,6 +5638,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -5579,6 +5638,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
isConsigneeChange
&&
consigneeVO
.
getCustomerId
()
!=
null
)
{
if
(
isConsigneeChange
&&
consigneeVO
.
getCustomerId
()
!=
null
)
{
customerService
.
updateCustomerStatusByExistedOrderAndOffer
(
consigneeVO
.
getCustomerId
(),
true
);
customerService
.
updateCustomerStatusByExistedOrderAndOffer
(
consigneeVO
.
getCustomerId
(),
true
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"更新收发货人状态时出现异常"
,
e
);
log
.
error
(
"更新收发货人状态时出现异常"
,
e
);
}
}
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/vo/order/OrderBackVO.java
View file @
c1b53931
...
@@ -561,6 +561,8 @@ public class OrderBackVO {
...
@@ -561,6 +561,8 @@ public class OrderBackVO {
@ApiModelProperty
(
value
=
"是否变动付款人信息"
)
@ApiModelProperty
(
value
=
"是否变动付款人信息"
)
private
Boolean
isDrawee
=
false
;
private
Boolean
isDrawee
=
false
;
@ApiModelProperty
(
value
=
"是否变动发货人设置订单控货无收货人属性"
)
private
Boolean
isChargeNoConsignee
=
false
;
@ApiModelProperty
(
value
=
"是否需要产生未分配客户经理异常异常"
)
@ApiModelProperty
(
value
=
"是否需要产生未分配客户经理异常异常"
)
private
Boolean
isCreateCustomerServiceException
=
false
;
private
Boolean
isCreateCustomerServiceException
=
false
;
...
...
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