Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
王衍超
cloud-fb
Commits
15625736
Commit
15625736
authored
Apr 16, 2021
by
shiwenbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
给场站和购砂单位系统提供common/batch接口
parent
4aa5060b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
0 deletions
+212
-0
SandQueryController.java
...main/java/com/xyst/dinas/biz/web/SandQueryController.java
+106
-0
WarehouseQueryController.java
...java/com/xyst/dinas/biz/web/WarehouseQueryController.java
+106
-0
No files found.
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/SandQueryController.java
View file @
15625736
...
@@ -5,6 +5,8 @@ import java.util.ArrayList;
...
@@ -5,6 +5,8 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
import
javax.servlet.http.HttpServletRequest
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,6 +38,12 @@ import com.beecode.bcp.biz.BusinessException;
...
@@ -36,6 +38,12 @@ import com.beecode.bcp.biz.BusinessException;
import
com.beecode.bcp.query.scene.ScenePrecidate
;
import
com.beecode.bcp.query.scene.ScenePrecidate
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
import
com.beecode.inz.common.BatchDeleteItem
;
import
com.beecode.inz.common.BatchDiscardItem
;
import
com.beecode.inz.common.BatchUpdatePICItem
;
import
com.beecode.inz.common.enumeration.BatchOperationEnum
;
import
com.beecode.inz.common.service.CommonService
;
import
com.beecode.inz.common.service.FollowerService
;
import
com.beecode.inz.query.define.QueryDefinition
;
import
com.beecode.inz.query.define.QueryDefinition
;
import
com.beecode.inz.query.entity.PaginationResult
;
import
com.beecode.inz.query.entity.PaginationResult
;
import
com.beecode.inz.query.exception.QueryException
;
import
com.beecode.inz.query.exception.QueryException
;
...
@@ -61,6 +69,15 @@ public class SandQueryController {
...
@@ -61,6 +69,15 @@ public class SandQueryController {
private
PrivilegeService
privilegeService
;
private
PrivilegeService
privilegeService
;
@Autowired
@Autowired
private
HttpServletRequest
request
;
@Autowired
private
CommonService
commonService
;
@Autowired
private
FollowerService
followerService
;
@Autowired
MultipartProperties
multipartProperties
;
MultipartProperties
multipartProperties
;
...
@@ -69,6 +86,95 @@ public class SandQueryController {
...
@@ -69,6 +86,95 @@ public class SandQueryController {
private
static
final
ObjectMapper
OBJECTMAPPER
=
new
ObjectMapper
();
private
static
final
ObjectMapper
OBJECTMAPPER
=
new
ObjectMapper
();
@ResponseBody
@ResponseBody
@RequestMapping
(
value
=
"/sand/user/common/batch"
,
method
=
RequestMethod
.
PUT
)
public
void
batchOperation
(
@RequestBody
String
body
){
String
operation
=
request
.
getHeader
(
"operation"
);
BatchOperationEnum
oper
=
null
;
try
{
oper
=
BatchOperationEnum
.
valueOf
(
operation
.
toUpperCase
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"not support common batch operation,operation: {}"
,
operation
);
throw
new
UnsupportedOperationException
(
"not support common batch operation,operation: "
+
operation
);
}
switch
(
oper
)
{
case
BATCH_UPDATE_PIC:
BatchUpdatePICItem
[]
batchUpdatePICs
=
handleBatchUpdatePICInputs
(
body
);
commonService
.
batchUpdatePIC
(
batchUpdatePICs
);
//如果负责人已经在相关团队里面了,从相关团队里面移除
for
(
BatchUpdatePICItem
batchUpdatePICItem
:
batchUpdatePICs
)
{
UUID
[]
entityIds
=
batchUpdatePICItem
.
getIds
();
for
(
UUID
entityID
:
entityIds
)
{
followerService
.
removeStaff
(
batchUpdatePICItem
.
getDatamodelName
(),
entityID
,
batchUpdatePICItem
.
getPic
().
getId
());
}
}
return
;
case
BATCH_DISCARD:
BatchDiscardItem
[]
batchDiscards
=
handleBatchDiscardInputs
(
body
);
commonService
.
batchDiscard
(
batchDiscards
);
return
;
case
BATCH_DELETE:
BatchDeleteItem
[]
batchDeletes
=
handleBatchDeleteInputs
(
body
);
commonService
.
batchDelete
(
batchDeletes
);
return
;
default
:
logger
.
error
(
"not support common batch operation,operation: {}"
,
operation
);
throw
new
UnsupportedOperationException
(
"not support common batch operation,operation: "
+
operation
);
}
}
private
BatchUpdatePICItem
[]
handleBatchUpdatePICInputs
(
String
body
){
try
{
List
<
BatchUpdatePICItem
>
list
=
new
ArrayList
<
BatchUpdatePICItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch update PIC items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchUpdatePICItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchUpdatePICItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
private
BatchDiscardItem
[]
handleBatchDiscardInputs
(
String
body
){
try
{
List
<
BatchDiscardItem
>
list
=
new
ArrayList
<
BatchDiscardItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch discard items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchDiscardItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchDiscardItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
private
BatchDeleteItem
[]
handleBatchDeleteInputs
(
String
body
)
{
try
{
List
<
BatchDeleteItem
>
list
=
new
ArrayList
<
BatchDeleteItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch delete items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchDeleteItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchDeleteItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
@ResponseBody
@RequestMapping
(
value
=
"/sand/user/common/config/getMaxFileSize"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
@RequestMapping
(
value
=
"/sand/user/common/config/getMaxFileSize"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
public
String
getMaxFileSize
()
{
public
String
getMaxFileSize
()
{
JSONObject
o
=
new
JSONObject
();
JSONObject
o
=
new
JSONObject
();
...
...
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/WarehouseQueryController.java
View file @
15625736
...
@@ -5,6 +5,8 @@ import java.util.ArrayList;
...
@@ -5,6 +5,8 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
import
javax.servlet.http.HttpServletRequest
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,6 +38,12 @@ import com.beecode.bcp.biz.BusinessException;
...
@@ -36,6 +38,12 @@ import com.beecode.bcp.biz.BusinessException;
import
com.beecode.bcp.query.scene.ScenePrecidate
;
import
com.beecode.bcp.query.scene.ScenePrecidate
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
import
com.beecode.inz.common.BatchDeleteItem
;
import
com.beecode.inz.common.BatchDiscardItem
;
import
com.beecode.inz.common.BatchUpdatePICItem
;
import
com.beecode.inz.common.enumeration.BatchOperationEnum
;
import
com.beecode.inz.common.service.CommonService
;
import
com.beecode.inz.common.service.FollowerService
;
import
com.beecode.inz.query.define.QueryDefinition
;
import
com.beecode.inz.query.define.QueryDefinition
;
import
com.beecode.inz.query.entity.PaginationResult
;
import
com.beecode.inz.query.entity.PaginationResult
;
import
com.beecode.inz.query.exception.QueryException
;
import
com.beecode.inz.query.exception.QueryException
;
...
@@ -61,6 +69,15 @@ public class WarehouseQueryController {
...
@@ -61,6 +69,15 @@ public class WarehouseQueryController {
private
PrivilegeService
privilegeService
;
private
PrivilegeService
privilegeService
;
@Autowired
@Autowired
private
HttpServletRequest
request
;
@Autowired
private
CommonService
commonService
;
@Autowired
private
FollowerService
followerService
;
@Autowired
MultipartProperties
multipartProperties
;
MultipartProperties
multipartProperties
;
...
@@ -69,6 +86,95 @@ public class WarehouseQueryController {
...
@@ -69,6 +86,95 @@ public class WarehouseQueryController {
private
static
final
ObjectMapper
OBJECTMAPPER
=
new
ObjectMapper
();
private
static
final
ObjectMapper
OBJECTMAPPER
=
new
ObjectMapper
();
@ResponseBody
@ResponseBody
@RequestMapping
(
value
=
"/warehouse/api/common/batch"
,
method
=
RequestMethod
.
PUT
)
public
void
batchOperation
(
@RequestBody
String
body
){
String
operation
=
request
.
getHeader
(
"operation"
);
BatchOperationEnum
oper
=
null
;
try
{
oper
=
BatchOperationEnum
.
valueOf
(
operation
.
toUpperCase
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"not support common batch operation,operation: {}"
,
operation
);
throw
new
UnsupportedOperationException
(
"not support common batch operation,operation: "
+
operation
);
}
switch
(
oper
)
{
case
BATCH_UPDATE_PIC:
BatchUpdatePICItem
[]
batchUpdatePICs
=
handleBatchUpdatePICInputs
(
body
);
commonService
.
batchUpdatePIC
(
batchUpdatePICs
);
//如果负责人已经在相关团队里面了,从相关团队里面移除
for
(
BatchUpdatePICItem
batchUpdatePICItem
:
batchUpdatePICs
)
{
UUID
[]
entityIds
=
batchUpdatePICItem
.
getIds
();
for
(
UUID
entityID
:
entityIds
)
{
followerService
.
removeStaff
(
batchUpdatePICItem
.
getDatamodelName
(),
entityID
,
batchUpdatePICItem
.
getPic
().
getId
());
}
}
return
;
case
BATCH_DISCARD:
BatchDiscardItem
[]
batchDiscards
=
handleBatchDiscardInputs
(
body
);
commonService
.
batchDiscard
(
batchDiscards
);
return
;
case
BATCH_DELETE:
BatchDeleteItem
[]
batchDeletes
=
handleBatchDeleteInputs
(
body
);
commonService
.
batchDelete
(
batchDeletes
);
return
;
default
:
logger
.
error
(
"not support common batch operation,operation: {}"
,
operation
);
throw
new
UnsupportedOperationException
(
"not support common batch operation,operation: "
+
operation
);
}
}
private
BatchUpdatePICItem
[]
handleBatchUpdatePICInputs
(
String
body
){
try
{
List
<
BatchUpdatePICItem
>
list
=
new
ArrayList
<
BatchUpdatePICItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch update PIC items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchUpdatePICItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchUpdatePICItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
private
BatchDiscardItem
[]
handleBatchDiscardInputs
(
String
body
){
try
{
List
<
BatchDiscardItem
>
list
=
new
ArrayList
<
BatchDiscardItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch discard items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchDiscardItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchDiscardItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
private
BatchDeleteItem
[]
handleBatchDeleteInputs
(
String
body
)
{
try
{
List
<
BatchDeleteItem
>
list
=
new
ArrayList
<
BatchDeleteItem
>();
JSONArray
arr
=
new
JSONArray
(
body
);
if
(
arr
.
length
()
==
0
){
throw
new
RuntimeException
(
"batch delete items must not be 0!"
);
}
for
(
int
i
=
0
;
i
<
arr
.
length
();
i
++){
list
.
add
(
new
BatchDeleteItem
(
arr
.
getJSONObject
(
i
)));
};
return
list
.
toArray
(
new
BatchDeleteItem
[
0
]);
}
catch
(
Exception
e
){
logger
.
error
(
"illegal Argument,body: {}"
,
body
);
throw
new
IllegalArgumentException
(
"illegal Argument,body: "
+
body
,
e
);
}
}
@ResponseBody
@RequestMapping
(
value
=
"/warehouse/api/common/config/getMaxFileSize"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
@RequestMapping
(
value
=
"/warehouse/api/common/config/getMaxFileSize"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
public
String
getMaxFileSize
()
{
public
String
getMaxFileSize
()
{
JSONObject
o
=
new
JSONObject
();
JSONObject
o
=
new
JSONObject
();
...
...
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