Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bill-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
bill-platform
Commits
7ed61ce1
Commit
7ed61ce1
authored
Jun 20, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加重复订单请求
parent
1e31d3d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
10 deletions
+74
-10
bill-manager/src/main/java/com/mortals/xhx/module/ph/web/PhQueueController.java
...java/com/mortals/xhx/module/ph/web/PhQueueController.java
+37
-5
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateController.java
...a/com/mortals/xhx/module/pj/web/PjEvaluateController.java
+37
-5
No files found.
bill-manager/src/main/java/com/mortals/xhx/module/ph/web/PhQueueController.java
View file @
7ed61ce1
...
...
@@ -9,7 +9,9 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.ph.model.PhQueueQuery
;
import
com.mortals.xhx.module.pj.model.PjEvaluateEntity
;
import
com.mortals.xhx.module.pj.model.PjEvaluateQuery
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -28,15 +30,11 @@ import com.mortals.xhx.module.ph.service.PhQueueService;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -83,9 +81,20 @@ public class PhQueueController extends BaseCRUDJsonBodyMappingController<PhQueue
public
String
save
(
@RequestBody
PhQueueEntity
entity
)
{
//获取站点信息
getSite
(
entity
);
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getExtNum
()))
{
PhQueueQuery
phQueueQuery
=
new
PhQueueQuery
();
phQueueQuery
.
setExtNum
(
entity
.
getExtNum
());
PhQueueEntity
phQueueEntity
=
this
.
service
.
selectOne
(
phQueueQuery
);
if
(!
ObjectUtils
.
isEmpty
(
phQueueEntity
))
{
return
JSONObject
.
toJSONString
(
Rest
.
fail
(
"该单号已存在,exetNum:"
+
entity
.
getExtNum
()));
}
}
return
super
.
save
(
entity
);
}
/**
* @param list
* @return
...
...
@@ -96,9 +105,32 @@ public class PhQueueController extends BaseCRUDJsonBodyMappingController<PhQueue
for
(
PhQueueEntity
entity
:
list
)
{
getSite
(
entity
);
}
removeDuplicate
(
list
);
return
super
.
batchSave
(
list
);
}
//去掉重复的元素
private
void
removeDuplicate
(
List
<
PhQueueEntity
>
list
)
{
//去重 关键exenum
List
<
String
>
extNumList
=
list
.
stream
().
map
(
m
->
m
.
getExtNum
()).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
PhQueueQuery
phQueueQuery
=
new
PhQueueQuery
();
phQueueQuery
.
setExtNumList
(
extNumList
);
List
<
PhQueueEntity
>
phQueueEntities
=
this
.
service
.
find
(
phQueueQuery
);
if
(!
ObjectUtils
.
isEmpty
(
phQueueEntities
))
{
Set
<
String
>
existSet
=
phQueueEntities
.
stream
().
map
(
item
->
item
.
getExtNum
()).
collect
(
Collectors
.
toSet
());
Iterator
<
PhQueueEntity
>
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
())
{
PhQueueEntity
next
=
iterator
.
next
();
if
(
existSet
.
contains
(
next
.
getExtNum
()))
{
log
.
info
(
"排号重复,extNum={}"
,
next
.
getExtNum
());
iterator
.
remove
();
}
}
}
}
private
void
getSite
(
PhQueueEntity
entity
)
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteId
()))
{
...
...
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateController.java
View file @
7ed61ce1
...
...
@@ -10,6 +10,8 @@ import com.mortals.xhx.common.pdu.RespData;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.ph.model.PhQueueEntity
;
import
com.mortals.xhx.module.ph.model.PhQueueQuery
;
import
com.mortals.xhx.module.pj.model.PjEvaluateQuery
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -28,15 +30,11 @@ import com.mortals.xhx.module.pj.service.PjEvaluateService;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -85,6 +83,16 @@ public class PjEvaluateController extends BaseCRUDJsonBodyMappingController<PjEv
public
String
save
(
@RequestBody
PjEvaluateEntity
entity
)
{
//获取站点信息
getSite
(
entity
);
//todo 去重
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getExtNum
()))
{
PjEvaluateQuery
pjEvaluateQuery
=
new
PjEvaluateQuery
();
pjEvaluateQuery
.
setExtNum
(
entity
.
getExtNum
());
PjEvaluateEntity
pjEvaluateEntity
=
this
.
service
.
selectOne
(
pjEvaluateQuery
);
if
(!
ObjectUtils
.
isEmpty
(
pjEvaluateEntity
))
{
return
JSONObject
.
toJSONString
(
Rest
.
fail
(
"该单号已存在,exetNum:"
+
entity
.
getExtNum
()));
}
}
return
super
.
save
(
entity
);
}
...
...
@@ -98,10 +106,34 @@ public class PjEvaluateController extends BaseCRUDJsonBodyMappingController<PjEv
for
(
PjEvaluateEntity
entity
:
list
)
{
getSite
(
entity
);
}
removeDuplicate
(
list
);
return
super
.
batchSave
(
list
);
}
//去掉重复的元素
private
void
removeDuplicate
(
List
<
PjEvaluateEntity
>
list
)
{
//去重 关键exenum
List
<
String
>
extNumList
=
list
.
stream
().
map
(
m
->
m
.
getExtNum
()).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
PjEvaluateQuery
pjEvaluateQuery
=
new
PjEvaluateQuery
();
pjEvaluateQuery
.
setExtNumList
(
extNumList
);
List
<
PjEvaluateEntity
>
pjEvaluateEntities
=
this
.
service
.
find
(
pjEvaluateQuery
);
if
(!
ObjectUtils
.
isEmpty
(
pjEvaluateEntities
))
{
Set
<
String
>
existSet
=
pjEvaluateEntities
.
stream
().
map
(
item
->
item
.
getExtNum
()).
collect
(
Collectors
.
toSet
());
Iterator
<
PjEvaluateEntity
>
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
())
{
PjEvaluateEntity
next
=
iterator
.
next
();
if
(
existSet
.
contains
(
next
.
getExtNum
()))
{
log
.
info
(
"排号重复,extNum={}"
,
next
.
getExtNum
());
iterator
.
remove
();
}
}
}
}
private
void
getSite
(
PjEvaluateEntity
entity
)
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSiteId
()))
{
...
...
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