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
5fe80db4
Commit
5fe80db4
authored
Apr 22, 2020
by
Suvalue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
汇总数据查询接口
parent
77bf4eb9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
23 deletions
+100
-23
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjValueMapper.java
+6
-0
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/AddBudgetValue.java
+13
-0
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
+59
-20
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SerProjValueServiceImpl.java
+5
-1
bsoft-api/src/main/resources/mapper/SerProjValueMapper.xml
+15
-0
bsoft-api/src/test/resources/generatorConfig.xml
+2
-2
No files found.
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjValueMapper.java
View file @
5fe80db4
...
...
@@ -23,4 +23,9 @@ public interface SerProjValueMapper {
@Param
(
"exponentId"
)
Integer
exponentId
,
@Param
(
"dept"
)
String
dept
,
@Param
(
"date"
)
Integer
date
,
@Param
(
"budgetType"
)
Integer
budgetType
);
int
deleteByDeptWithDate
(
@Param
(
"dept"
)
String
dept
,
@Param
(
"date"
)
BigDecimal
date
,
@Param
(
"projType"
)
Integer
projType
);
void
updateValue
(
@Param
(
"date"
)
BigDecimal
date
);
}
\ No newline at end of file
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/AddBudgetValue.java
View file @
5fe80db4
...
...
@@ -8,6 +8,10 @@ import java.math.BigDecimal;
import
java.util.List
;
public
class
AddBudgetValue
{
@ApiModelProperty
(
value
=
"类型"
)
@NotNull
(
message
=
"类型不能为空"
)
private
Integer
projType
;
@ApiModelProperty
(
value
=
"时间"
)
@NotNull
(
message
=
"时间不能为空"
)
private
BigDecimal
date
;
...
...
@@ -20,6 +24,15 @@ public class AddBudgetValue {
@NotNull
(
message
=
"数值不能为空"
)
private
List
<
BudgetValue
>
budgetValues
;
public
Integer
getProjType
()
{
return
projType
;
}
public
void
setProjType
(
Integer
projType
)
{
this
.
projType
=
projType
;
}
public
BigDecimal
getDate
()
{
return
date
;
}
...
...
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
View file @
5fe80db4
...
...
@@ -12,6 +12,7 @@ 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.commons.lang3.StringUtils
;
import
org.apache.ibatis.binding.MapperMethod
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
...
...
@@ -36,7 +37,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
@Override
public
List
<
BlockValue
>
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为
...
...
@@ -50,30 +51,30 @@ public class BlockValuesServiceImpl implements BlockValuesService {
String
inField
=
""
;
String
whereClause
=
"where 1=1"
;
if
(
disease
!=
null
){
whereClause
+=
String
.
format
(
" and disease='%s'"
,
disease
);
whereClause
+=
String
.
format
(
" and disease='%s'"
,
disease
);
inField
+=
"'disease',"
;
count
++;
}
if
(
doctor
!=
null
)
{
whereClause
+=
String
.
format
(
" and doctor='%s'"
,
doctor
);
if
(
doctor
!=
null
)
{
whereClause
+=
String
.
format
(
" and doctor='%s'"
,
doctor
);
inField
+=
"'doctor',"
;
count
++;
}
if
(
department
!=
null
)
{
whereClause
+=
String
.
format
(
" and department='%s'"
,
department
);
if
(
department
!=
null
)
{
whereClause
+=
String
.
format
(
" and department='%s'"
,
department
);
inField
+=
"'department',"
;
count
++;
}
if
(
time
!=
null
)
{
whereClause
+=
String
.
format
(
" and time='%s'"
,
time
);
if
(
time
!=
null
)
{
whereClause
+=
String
.
format
(
" and time='%s'"
,
time
);
inField
+=
"'time',"
;
count
++;
}
if
(
count
>
0
){
inField
=
inField
.
substring
(
0
,
inField
.
length
()-
1
);
inField
=
inField
.
substring
(
0
,
inField
.
length
()
-
1
);
}
List
<
SerPage
>
pageList
=
serPageMapper
.
selectByCodeAndDim
(
pageCode
,
inField
,
count
);
List
<
SerPage
>
pageList
=
serPageMapper
.
selectByCodeAndDim
(
pageCode
,
inField
,
count
);
if
(
pageList
.
size
()
==
0
){
throw
new
DBConfigurationError
(
"页面维度配置表错误,请联系管理员"
);
}
...
...
@@ -84,11 +85,11 @@ public class BlockValuesServiceImpl implements BlockValuesService {
List
<
SerPageBlockRs
>
pageBlocklist
=
serPageBlockRsMapper
.
selectByPageId
(
page
.
getId
());
//循环获取数据
CountDownLatch
latch
=
new
CountDownLatch
(
pageBlocklist
.
size
());
for
(
SerPageBlockRs
data
:
pageBlocklist
)
{
for
(
SerPageBlockRs
data
:
pageBlocklist
)
{
//获取表名
Long
blockId
=
data
.
getBlockId
();
String
tableName
=
"VAL_BLOCK_VALUES_"
+
blockId
;
asynBlockValuesServiceImpl
.
getBlockValues
(
list
,
blockId
,
tableName
,
whereClause
,
latch
);
asynBlockValuesServiceImpl
.
getBlockValues
(
list
,
blockId
,
tableName
,
whereClause
,
latch
);
}
latch
.
await
();
...
...
@@ -97,7 +98,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
}
@Override
public
List
<
BlockValue
>
getBlockValuesByPageCodeNew
(
Integer
pageCode
,
Map
<
String
,
String
>
dim
)
throws
InterruptedException
{
public
List
<
BlockValue
>
getBlockValuesByPageCodeNew
(
Integer
pageCode
,
Map
<
String
,
String
>
dim
)
throws
InterruptedException
{
/**
* 1.根据pageCode查询所有对应的pageId
* 查询要求为pageCode为当前pageCode,相同pageId的所有数据有且仅有DIM_ID为
...
...
@@ -118,7 +119,13 @@ public class BlockValuesServiceImpl implements BlockValuesService {
// inField = inField.substring(0, inField.length()-1);
// }
List
<
SerPage
>
pageList
=
serPageMapper
.
selectByCodeAndDimList
(
pageCode
,
inFields
,
inFields
.
size
());
for
(
Iterator
iterator
=
inFields
.
iterator
();
iterator
.
hasNext
();){
Object
obj
=
iterator
.
next
();
Object
value
=
dim
.
get
(
obj
);
remove
(
value
,
iterator
);
}
List
<
SerPage
>
pageList
=
serPageMapper
.
selectByCodeAndDimList
(
pageCode
,
inFields
,
inFields
.
size
());
// List<SerPage> pageList = serPageMapper.selectByCodeAndDim(pageCode, inField, count);
if
(
pageList
.
size
()
==
0
){
throw
new
DBConfigurationError
(
"页面维度配置表错误,请联系管理员"
);
...
...
@@ -130,18 +137,18 @@ public class BlockValuesServiceImpl implements BlockValuesService {
List
<
SerPageBlockRs
>
pageBlocklist
=
serPageBlockRsMapper
.
selectByPageId
(
page
.
getId
());
//循环获取数据
CountDownLatch
latch
=
new
CountDownLatch
(
pageBlocklist
.
size
());
for
(
SerPageBlockRs
data
:
pageBlocklist
)
{
for
(
SerPageBlockRs
data
:
pageBlocklist
)
{
//获取表名
Long
blockId
=
data
.
getBlockId
();
String
tableName
=
"VAL_BLOCK_VALUES_"
+
pageCode
+
"_"
+
page
.
getId
()+
"_"
+
blockId
;
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>(){
String
tableName
=
"VAL_BLOCK_VALUES_"
+
pageCode
+
"_"
+
page
.
getId
()
+
"_"
+
blockId
;
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>()
{
{
put
(
"tableName"
,
tableName
);
put
(
"whereSql"
,
data
.
getWhereClause
());
put
(
"whereSql"
,
data
.
getWhereClause
());
putAll
(
dim
);
}
};
asynBlockValuesServiceImpl
.
getBlockValuesNew
(
list
,
blockId
,
map
,
latch
);
asynBlockValuesServiceImpl
.
getBlockValuesNew
(
list
,
blockId
,
map
,
latch
);
}
latch
.
await
();
...
...
@@ -150,5 +157,37 @@ public class BlockValuesServiceImpl implements BlockValuesService {
}
private
static
void
remove
(
Object
obj
,
Iterator
iterator
)
{
if
(
obj
instanceof
String
){
String
str
=
(
String
)
obj
;
if
(
StringUtils
.
isBlank
(
str
)){
iterator
.
remove
();
}
}
else
if
(
obj
instanceof
Collection
){
Collection
col
=
(
Collection
)
obj
;
if
(
col
==
null
||
col
.
isEmpty
()){
iterator
.
remove
();
}
}
else
if
(
obj
instanceof
Map
){
Map
temp
=
(
Map
)
obj
;
if
(
temp
==
null
||
temp
.
isEmpty
()){
iterator
.
remove
();
}
}
else
if
(
obj
instanceof
Object
[]){
Object
[]
array
=
(
Object
[])
obj
;
if
(
array
==
null
||
array
.
length
<=
0
){
iterator
.
remove
();
}
}
else
{
if
(
obj
==
null
){
iterator
.
remove
();
}
}
}
}
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SerProjValueServiceImpl.java
View file @
5fe80db4
...
...
@@ -69,6 +69,8 @@ public class SerProjValueServiceImpl implements SerProjValueService {
public
boolean
save
(
AddBudgetValue
request
)
{
int
result
=
0
;
if
(
request
!=
null
&&
request
.
getBudgetValues
()
!=
null
&&
request
.
getBudgetValues
().
size
()
>
0
){
//先进行删除操作
result
=
serProjValueMapper
.
deleteByDeptWithDate
(
request
.
getDeptCode
(),
request
.
getDate
(),
request
.
getProjType
());
SerProjValue
info
=
null
;
long
version
=
System
.
currentTimeMillis
();
for
(
BudgetValue
budgetValue
:
request
.
getBudgetValues
()){
...
...
@@ -78,8 +80,10 @@ public class SerProjValueServiceImpl implements SerProjValueService {
info
.
setCreateDate
(
new
Date
());
info
.
setState
(
BigDecimal
.
valueOf
(
StateType
.
ON
.
getValue
()));
info
.
setVersion
(
String
.
valueOf
(
version
));
result
=
serProjValueMapper
.
insert
(
info
);
serProjValueMapper
.
insert
(
info
);
}
//调用计算数值存储过程
serProjValueMapper
.
updateValue
(
request
.
getDate
());
}
return
result
>
0
;
}
...
...
bsoft-api/src/main/resources/mapper/SerProjValueMapper.xml
View file @
5fe80db4
...
...
@@ -131,4 +131,18 @@
</if>
ORDER BY p.SORT
</select>
<update
id=
"deleteByDeptWithDate"
>
update SER_PROJ_VALUE v1 set v1.STATE = 0
where EXISTS(select v.ID from SER_PROJ_VALUE v
join SER_PROJ p on p.ID = v.PROJ_ID
where p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
and v."DATE" = #{date,jdbcType=DECIMAL}
and v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
and v1.ID = v.ID)
</update>
<update
id=
"updateValue"
statementType=
"CALLABLE"
>
{call ESTIMATE_UPDATE_GZD_BL(
#{date,jdbcType=DECIMAL}
)}
</update>
</mapper>
\ No newline at end of file
bsoft-api/src/test/resources/generatorConfig.xml
View file @
5fe80db4
...
...
@@ -42,8 +42,8 @@
<!-- 生成映射接口配置 -->
<javaClientGenerator
targetPackage=
"com.bsoft.api.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
/>
<table
tableName=
"SER_P
AGE_VALUE_CONFIG
"
>
<generatedKey
column=
"id"
sqlStatement=
"select SEQ_SER_P
AGE_VALUE_CONFIG
_ID.nextval from dual"
identity=
"true"
/>
<table
tableName=
"SER_P
ROJ_VALUE_HISTORY
"
>
<generatedKey
column=
"id"
sqlStatement=
"select SEQ_SER_P
ROJ_VALUE_HISTORY
_ID.nextval from dual"
identity=
"true"
/>
</table>
</context>
...
...
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