Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9b415000
authored
Jun 30, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改善了order_request的id字段(改用了snowflake)
1 parent
43cccd29
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
project-order/pom.xml
project-order/src/main/java/com/dituhui/pea/order/service/CommonService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/pom.xml
View file @
9b41500
...
...
@@ -92,6 +92,11 @@
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.5
</version>
</dependency>
</dependencies>
<build>
...
...
project-order/src/main/java/com/dituhui/pea/order/service/CommonService.java
View file @
9b41500
...
...
@@ -36,20 +36,24 @@ public class CommonService {
public
String
getTeamIdByInput
(
String
location
,
String
address
,
String
layer
)
{
// todo 目前会随机兜底,后面将合理化
log
.
info
(
"====== getTeamIdByInput ==="
);
String
teamId
=
null
;
List
<
LayerAndArea
>
layerAndAreas
=
getLayerAndAreas
(
location
,
address
);
if
(
layerAndAreas
==
null
||
layerAndAreas
.
size
()
==
0
)
{
// 分单接口没有查到,本地随机处理一下
teamId
=
capacityTeamStatDao
.
getRandomTeamIdByLayer
(
layer
);
}
else
{
// 分单接口查到了areaId(blockId),查询map_block_info,从而限定groupId,然后再随机teamId,这样就相对真实一点
// 生成随机索引
int
randomIndex
=
new
Random
().
nextInt
(
layerAndAreas
.
size
());
// 获取随机元素
LayerAndArea
layerAndArea
=
layerAndAreas
.
get
(
randomIndex
);
teamId
=
mapBlockInfoDao
.
getTeamIdByBlockIdAndLayer
(
layerAndArea
.
areaId
,
layer
);
log
.
info
(
"layerAndArea=={}, teamId=={}"
,
layerAndArea
,
teamId
);
}
if
(
StringUtils
.
isEmpty
(
teamId
))
{
teamId
=
capacityTeamStatDao
.
getRandomTeamId
();
log
.
info
(
"查询没有teamId,需要随机生成teamId=={}"
,
teamId
);
}
log
.
info
(
"teamId ==> {}"
,
teamId
);
assert
(
StringUtils
.
isNotEmpty
(
teamId
));
...
...
@@ -125,7 +129,7 @@ public class CommonService {
private
String
areaName
;
}
public
void
addOrderChange
(
String
orderId
,
String
subOrderId
,
String
source
,
String
operator
,
String
content
,
String
memo
){
public
void
addOrderChange
(
String
orderId
,
String
subOrderId
,
String
source
,
String
operator
,
String
content
,
String
memo
)
{
OrderChangeEntity
entity
=
new
OrderChangeEntity
();
entity
.
setOrderId
(
orderId
).
setSuborderId
(
subOrderId
).
setSource
(
source
).
setOperator
(
operator
).
setContent
(
content
).
setMemo
(
memo
);
entity
.
setCreateTime
(
new
Date
()).
setUpdateTime
(
new
Date
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
9b41500
...
...
@@ -16,6 +16,7 @@
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
cn.hutool.core.util.IdUtil
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dao.OrderRequestDao
;
import
com.dituhui.pea.order.dao.OrgTeamDao
;
...
...
@@ -85,7 +86,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
public
Result
<?>
createOrder
(
OrderCreateReqDTO
req
)
{
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
OrderRequestEntity
entity
=
new
OrderRequestEntity
();
entity
.
setId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
entity
.
setId
(
IdUtil
.
getSnowflake
().
nextIdStr
(
));
String
orderId
=
req
.
getOrderId
();
if
(
StringUtils
.
isEmpty
(
orderId
))
{
orderId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment