Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv-springboot
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bsoft
sv-springboot
Commits
f48d5628
Commit
f48d5628
authored
Oct 31, 2019
by
whl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整返回结果数据格式
parent
ef3b2855
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
20 deletions
+54
-20
bsoft-api/src/main/java/com/bsoft/api/common/handlers/GlobalExceptionHandler.java
+4
-4
bsoft-api/src/main/java/com/bsoft/api/controller/BlockValuesController.java
+2
-2
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/BlockValue.java
+32
-0
bsoft-api/src/main/java/com/bsoft/api/service/AsynBlockValuesService.java
+4
-2
bsoft-api/src/main/java/com/bsoft/api/service/BlockValuesService.java
+3
-1
bsoft-api/src/main/java/com/bsoft/api/service/Impl/AsynBlockValuesServiceImpl.java
+5
-8
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
+4
-3
No files found.
bsoft-api/src/main/java/com/bsoft/api/common/handlers/GlobalExceptionHandler.java
View file @
f48d5628
...
...
@@ -29,7 +29,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
public
Object
defaultErrorHandler
(
HttpServletRequest
request
,
Exception
e
){
String
url
=
HttpUtil
.
getIP
(
request
);
String
url
=
request
.
getRequestURI
(
);
log
.
error
(
url
+
"请求未知异常:"
+
e
.
getMessage
(),
e
.
getStackTrace
());
return
Result
.
error
();
}
...
...
@@ -43,7 +43,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
ExceptionBase
.
class
)
@ResponseBody
public
Object
BaseErrorHandler
(
HttpServletRequest
request
,
Exception
e
){
String
url
=
HttpUtil
.
getIP
(
request
);
String
url
=
request
.
getRequestURI
(
);
log
.
error
(
url
+
"请求未知异常:"
+
e
.
getMessage
(),
e
.
getStackTrace
());
return
Result
.
error
();
}
...
...
@@ -51,7 +51,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
DBConfigurationError
.
class
)
@ResponseBody
public
Object
DBConfigurationErrorHandler
(
HttpServletRequest
request
,
Exception
e
){
String
url
=
HttpUtil
.
getIP
(
request
);
String
url
=
request
.
getRequestURI
(
);
log
.
error
(
url
+
"请求未知异常:"
+
e
.
getMessage
(),
e
.
getStackTrace
());
return
Result
.
error
(
400
,
e
.
getMessage
());
}
...
...
@@ -65,7 +65,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
InvalidTokenException
.
class
)
@ResponseBody
public
Object
InvalidTokenExceptionHandler
(
HttpServletRequest
request
,
Exception
e
){
String
url
=
HttpUtil
.
getIP
(
request
);
String
url
=
request
.
getRequestURI
(
);
log
.
error
(
url
+
"请求未知异常:"
+
e
.
getMessage
(),
e
.
getStackTrace
());
return
Result
.
error
(
Result
.
ErrorCode
.
INVALID_TOKEN
);
}
...
...
bsoft-api/src/main/java/com/bsoft/api/controller/BlockValuesController.java
View file @
f48d5628
...
...
@@ -3,6 +3,7 @@ package com.bsoft.api.controller;
import
com.bsoft.api.common.Result
;
import
com.bsoft.api.common.annotations.Token
;
import
com.bsoft.api.model.reqmodel.BlockValues
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
com.bsoft.api.service.BlockValuesService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
@Api
(
tags
=
"板块数值Api"
)
@RestController
...
...
@@ -32,7 +32,7 @@ public class BlockValuesController {
@ApiOperation
(
"根据Page查询板块数值"
)
public
Object
getBlockValuesByPageID
(
@RequestBody
BlockValues
blockValues
)
throws
InterruptedException
{
List
<
Map
<
String
,
Object
>
>
list
=
blockValuesService
.
getBlockValuesByPageCode
(
blockValues
.
getPageCode
(),
List
<
BlockValue
>
list
=
blockValuesService
.
getBlockValuesByPageCode
(
blockValues
.
getPageCode
(),
blockValues
.
getDisease
(),
blockValues
.
getDoctor
(),
blockValues
.
getDepartment
(),
blockValues
.
getTime
());
return
Result
.
success
(
list
);
}
...
...
bsoft-api/src/main/java/com/bsoft/api/model/respmodel/BlockValue.java
0 → 100644
View file @
f48d5628
package
com
.
bsoft
.
api
.
model
.
respmodel
;
import
java.util.List
;
import
java.util.Map
;
public
class
BlockValue
{
private
long
blockId
;
private
List
<
Map
<
String
,
Object
>>
body
;
public
BlockValue
(){}
public
BlockValue
(
long
blockId
,
List
<
Map
<
String
,
Object
>>
body
)
{
this
.
blockId
=
blockId
;
this
.
body
=
body
;
}
public
long
getBlockId
()
{
return
blockId
;
}
public
void
setBlockId
(
long
blockId
)
{
this
.
blockId
=
blockId
;
}
public
List
<
Map
<
String
,
Object
>>
getBody
()
{
return
body
;
}
public
void
setBody
(
List
<
Map
<
String
,
Object
>>
body
)
{
this
.
body
=
body
;
}
}
bsoft-api/src/main/java/com/bsoft/api/service/AsynBlockValuesService.java
View file @
f48d5628
package
com
.
bsoft
.
api
.
service
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CountDownLatch
;
public
interface
AsynBlockValuesService
{
void
getBlockValues
(
List
<
Map
<
String
,
Object
>>
list
,
Stri
ng
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
);
void
getBlockValues
(
List
<
BlockValue
>
list
,
Lo
ng
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
);
}
bsoft-api/src/main/java/com/bsoft/api/service/BlockValuesService.java
View file @
f48d5628
package
com
.
bsoft
.
api
.
service
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
java.util.List
;
import
java.util.Map
;
public
interface
BlockValuesService
{
List
<
Map
<
String
,
Object
>
>
getBlockValuesByPageCode
(
Integer
pageId
,
Integer
disease
,
Integer
doctor
,
Integer
department
,
Integer
time
)
throws
InterruptedException
;
List
<
BlockValue
>
getBlockValuesByPageCode
(
Integer
pageId
,
Integer
disease
,
Integer
doctor
,
Integer
department
,
Integer
time
)
throws
InterruptedException
;
}
bsoft-api/src/main/java/com/bsoft/api/service/Impl/AsynBlockValuesServiceImpl.java
View file @
f48d5628
package
com
.
bsoft
.
api
.
service
.
Impl
;
import
com.bsoft.api.mapper.BlockValuesMapper
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
com.bsoft.api.service.AsynBlockValuesService
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
...
...
@@ -21,18 +22,14 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService {
@Async
@Override
public
void
getBlockValues
(
List
<
Map
<
String
,
Object
>>
list
,
Stri
ng
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
)
{
public
void
getBlockValues
(
List
<
BlockValue
>
list
,
Lo
ng
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
)
{
System
.
out
.
println
(
"开始"
+
tableName
);
List
<
Map
<
String
,
Object
>>
dataList
=
blockValuesMapper
.
selectByWhere
(
tableName
,
whereClause
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>(){
{
put
(
blockId
,
dataList
);
}
};
BlockValue
blockValue
=
new
BlockValue
(
blockId
,
dataList
);
synchronized
(
obj
){
list
.
add
(
map
);
list
.
add
(
blockValue
);
}
System
.
out
.
println
(
"结束"
+
tableName
);
latch
.
countDown
();
...
...
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
View file @
f48d5628
...
...
@@ -8,6 +8,7 @@ import com.bsoft.api.mapper.SerPageMapper;
import
com.bsoft.api.model.DicDim
;
import
com.bsoft.api.model.SerPage
;
import
com.bsoft.api.model.SerPageBlockRs
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
com.bsoft.api.service.AsynBlockValuesService
;
import
com.bsoft.api.service.BlockValuesService
;
import
org.apache.ibatis.binding.MapperMethod
;
...
...
@@ -37,7 +38,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
@Override
public
List
<
Map
<
String
,
Object
>
>
getBlockValuesByPageCode
(
Integer
pageCode
,
Integer
disease
,
Integer
doctor
,
Integer
department
,
Integer
time
)
throws
InterruptedException
{
public
List
<
BlockValue
>
getBlockValuesByPageCode
(
Integer
pageCode
,
Integer
disease
,
Integer
doctor
,
Integer
department
,
Integer
time
)
throws
InterruptedException
{
/**
* 1.根据pageCode,disease,doctor,department,time查询所有对应的pageId
* 查询要求为pageCode为当前pageCode,相同pageId的所有数据有且仅有DIM_ID为
...
...
@@ -45,7 +46,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
* 2.根据pageId获取所有block
* 3.根据block拼接表名及where语句
*/
List
<
Map
<
String
,
Object
>
>
list
=
new
ArrayList
<>();
List
<
BlockValue
>
list
=
new
ArrayList
<>();
int
count
=
0
;
String
inField
=
""
;
...
...
@@ -87,7 +88,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
CountDownLatch
latch
=
new
CountDownLatch
(
pageBlocklist
.
size
());
for
(
SerPageBlockRs
data
:
pageBlocklist
)
{
//获取表名
String
blockId
=
data
.
getBlockId
().
toString
();
Long
blockId
=
data
.
getBlockId
();
String
tableName
=
"VAL_BLOCK_VALUES_"
+
blockId
;
asynBlockValuesServiceImpl
.
getBlockValues
(
list
,
blockId
,
tableName
,
whereClause
,
latch
);
...
...
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