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
Show 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,9 +794,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -792,9 +794,9 @@ 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
);
...
@@ -903,6 +905,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -903,6 +905,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeService
.
save
(
orderConsigneeDO
);
orderConsigneeService
.
save
(
orderConsigneeDO
);
}
}
}
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
createReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
// 发货人 1 收货人 2
// 发货人 1 收货人 2
...
@@ -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,6 +2979,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -2974,6 +2979,7 @@ 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
(
updateObj
.
getIsCargoControl
()
&&
!
noConsignee
)
{
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
=
new
OrderConsigneeDO
();
}
}
...
@@ -3039,6 +3045,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3039,6 +3045,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
}
}
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
}
else
{
// 如果控货订单发货人设置了控货无收货人,则需要删除订单已有收货人
if
(
Objects
.
nonNull
(
orderConsigneeDO
)){
orderConsigneeService
.
removeById
(
orderConsigneeDO
.
getId
());
orderConsigneeDO
=
null
;
}
}
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,6 +3196,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3181,6 +3196,9 @@ 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
(
updateObj
.
getIsCargoControl
()
&&
!
noConsignee
)
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
if
(
Objects
.
isNull
(
orderConsigneeDO
))
{
orderConsigneeDO
=
new
OrderConsigneeDO
();
orderConsigneeDO
=
new
OrderConsigneeDO
();
}
}
...
@@ -3278,6 +3296,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
...
@@ -3278,6 +3296,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
if
(
StringUtils
.
isNotBlank
(
orderConsigneeDO
.
getPhone
()))
{
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
orderConsigneeService
.
saveOrUpdate
(
orderConsigneeDO
);
}
}
}
else
{
// 如果控货订单发货人设置了控货无收货人,则需要删除订单已有收货人
if
(
Objects
.
nonNull
(
orderConsigneeDO
)){
orderConsigneeService
.
removeById
(
orderConsigneeDO
.
getId
());
orderConsigneeDO
=
null
;
}
consigneeDO
=
null
;
}
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
if
(!
Objects
.
equals
(
updateReqVO
.
getStatus
(),
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
OrderStatusEnum
.
DRAFT
.
getValue
()))
{
//customerType 发货人 1 收货人 2
//customerType 发货人 1 收货人 2
...
...
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