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
77bf4eb9
Commit
77bf4eb9
authored
Apr 20, 2020
by
Suvalue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
汇总数据查询接口
parent
048c3c81
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
155 additions
and
35 deletions
+155
-35
bsoft-api/src/main/java/com/bsoft/api/common/enums/BudgetType.java
+44
-0
bsoft-api/src/main/java/com/bsoft/api/controller/DeptController.java
+7
-4
bsoft-api/src/main/java/com/bsoft/api/controller/SerProjValueController.java
+1
-1
bsoft-api/src/main/java/com/bsoft/api/controller/UserController.java
+28
-5
bsoft-api/src/main/java/com/bsoft/api/mapper/DicOrgMapper.java
+4
-0
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjMapper.java
+2
-1
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjValueMapper.java
+2
-1
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/QuerySummary.java
+2
-0
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SerProjValueServiceImpl.java
+15
-8
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SysUserOrgRsServiceImpl.java
+11
-1
bsoft-api/src/main/java/com/bsoft/api/service/SerProjValueService.java
+1
-1
bsoft-api/src/main/java/com/bsoft/api/service/SysUserOrgRsService.java
+4
-0
bsoft-api/src/main/resources/mapper/DicOrgMapper.xml
+20
-5
bsoft-api/src/main/resources/mapper/SerProjMapper.xml
+12
-6
bsoft-api/src/main/resources/mapper/SerProjValueMapper.xml
+2
-2
No files found.
bsoft-api/src/main/java/com/bsoft/api/common/enums/BudgetType.java
0 → 100644
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
common
.
enums
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
enum
BudgetType
{
NOT
(
1
,
"无"
),
SUMMARY
(
2
,
"汇总"
),
OUT
(
4
,
"门诊"
),
SUMMARY_OUT
(
8
,
"汇总/门诊"
);
private
int
value
;
private
String
desc
;
BudgetType
(
int
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
int
getValue
()
{
return
value
;
}
public
String
getDesc
()
{
return
desc
;
}
public
static
List
<
Map
<
String
,
Object
>>
all
()
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
BudgetType
projectType
:
values
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>()
{
{
put
(
"value"
,
projectType
.
getValue
());
put
(
"description"
,
projectType
.
getDesc
());
}
};
list
.
add
(
map
);
}
return
list
;
}
}
bsoft-api/src/main/java/com/bsoft/api/controller/DeptController.java
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
controller
;
import
com.bsoft.api.common.Result
;
import
com.bsoft.api.common.annotations.CurrentUser
;
import
com.bsoft.api.common.annotations.Token
;
import
com.bsoft.api.model.SerDepartment
;
import
com.bsoft.api.model.reqmodel.QuerySummary
;
import
com.bsoft.api.service.SerDeptService
;
import
com.bsoft.api.service.SysUserOrgRsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.List
;
...
...
@@ -18,7 +21,7 @@ import java.util.List;
@RestController
public
class
DeptController
{
@Autowired
private
S
erDeptService
serDept
Service
;
private
S
ysUserOrgRsService
sysUserOrgRs
Service
;
/**
* 查询科室列表
...
...
@@ -28,8 +31,8 @@ public class DeptController {
@PostMapping
(
"/dept/list"
)
@Token
@ApiOperation
(
"查询科室列表"
)
public
Object
getList
(
@
RequestBody
QuerySummary
req
)
{
List
<
SerDepartment
>
list
=
serDeptService
.
getList
(
req
.
getDate
()
);
return
Result
.
success
(
l
ist
);
public
Object
getList
(
@
ApiIgnore
@CurrentUser
Long
userId
)
{
List
<
SerDepartment
>
sysMenuList
=
sysUserOrgRsService
.
getUserOrg
(
userId
);
return
Result
.
success
(
sysMenuL
ist
);
}
}
bsoft-api/src/main/java/com/bsoft/api/controller/SerProjValueController.java
View file @
77bf4eb9
...
...
@@ -45,7 +45,7 @@ public class SerProjValueController {
@Token
@ApiOperation
(
"查询预算编制汇总数据"
)
public
Object
getSummary
(
@RequestBody
QuerySummary
request
)
throws
Throwable
{
Object
result
=
projValueService
.
getSummary
(
request
.
getDate
());
Object
result
=
projValueService
.
getSummary
(
request
.
getDate
()
,
request
.
getBudgetType
()
);
return
Result
.
success
(
result
);
}
...
...
bsoft-api/src/main/java/com/bsoft/api/controller/UserController.java
View file @
77bf4eb9
...
...
@@ -3,21 +3,26 @@ package com.bsoft.api.controller;
import
com.bsoft.api.common.Result
;
import
com.bsoft.api.common.annotations.CurrentUser
;
import
com.bsoft.api.common.annotations.Token
;
import
com.bsoft.api.model.SerDepartment
;
import
com.bsoft.api.model.SysRole
;
import
com.bsoft.api.model.SysUser
;
import
com.bsoft.api.model.respmodel.SysMenuList
;
import
com.bsoft.api.service.SysMenuService
;
import
com.bsoft.api.service.SysUserOrgRsService
;
import
com.bsoft.api.service.SysUserRoleRsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.List
;
@Api
(
tags
=
"用户API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
@Api
(
tags
=
"用户API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
@RequestMapping
(
"/user"
)
@RestController
public
class
UserController
{
...
...
@@ -25,38 +30,56 @@ public class UserController {
private
SysUserRoleRsService
sysUserRoleRsService
;
@Autowired
private
SysMenuService
sysMenuService
;
@Autowired
private
SysUserOrgRsService
sysUserOrgRsService
;
@GetMapping
()
@ApiIgnore
public
Object
user
(
@CurrentUser
@ApiIgnore
SysUser
user
)
{
public
Object
user
(
@CurrentUser
@ApiIgnore
SysUser
user
)
{
return
Result
.
success
(
user
);
}
/**
* 根据用户id查询用户角色
*
* @param userId 用户id
* @return
*/
@PostMapping
(
"roles"
)
@Token
@ApiOperation
(
"查询用户角色"
)
public
Object
getRoleListByUser
(
@ApiIgnore@CurrentUser
Long
userId
)
throws
Exception
{
public
Object
getRoleListByUser
(
@ApiIgnore
@CurrentUser
Long
userId
)
throws
Exception
{
List
<
SysRole
>
sysRoleList
=
sysUserRoleRsService
.
getRoleListByUser
(
userId
);
return
Result
.
success
(
sysRoleList
);
}
/**
* 根据用户id查询用户菜单
*
* @param userId 用户id
* @return
*/
@PostMapping
(
"menus"
)
@Token
@ApiOperation
(
"查询用户菜单"
)
public
Object
getMenuByUser
(
@ApiIgnore@CurrentUser
Long
userId
)
throws
Exception
{
public
Object
getMenuByUser
(
@ApiIgnore
@CurrentUser
Long
userId
)
throws
Exception
{
List
<
SysMenuList
>
sysMenuList
=
sysMenuService
.
getMenu
(
userId
);
return
Result
.
success
(
sysMenuList
);
}
/**
* 根据用户id查询用户机构
*
* @param userId 用户id
* @return
*/
@PostMapping
(
"dept"
)
@Token
@ApiOperation
(
"查询用户科室"
)
public
Object
getOrgByUser
(
@ApiIgnore
@CurrentUser
Long
userId
)
throws
Exception
{
List
<
SerDepartment
>
sysMenuList
=
sysUserOrgRsService
.
getUserOrg
(
userId
);
return
Result
.
success
(
sysMenuList
);
}
}
bsoft-api/src/main/java/com/bsoft/api/mapper/DicOrgMapper.java
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
mapper
;
import
com.bsoft.api.model.DicOrg
;
import
com.bsoft.api.model.SerDepartment
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -17,4 +18,6 @@ public interface DicOrgMapper {
List
<
DicOrg
>
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
int
updateByPrimaryKey
(
DicOrg
record
);
List
<
SerDepartment
>
selectDeptByUser
(
@Param
(
"userId"
)
Long
userId
);
}
\ No newline at end of file
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjMapper.java
View file @
77bf4eb9
...
...
@@ -22,5 +22,5 @@ public interface SerProjMapper {
List
<
ProjectInfo
>
selectState
(
@Param
(
"projType"
)
Integer
projType
,
@Param
(
"typeState"
)
Integer
typeState
);
List
<
Summary
>
selectDept
(
@Param
(
"date"
)
Integer
date
);
List
<
Summary
>
selectDept
(
@Param
(
"date"
)
Integer
date
,
@Param
(
"budgetType"
)
Integer
budgetType
);
}
\ No newline at end of file
bsoft-api/src/main/java/com/bsoft/api/mapper/SerProjValueMapper.java
View file @
77bf4eb9
...
...
@@ -22,5 +22,5 @@ public interface SerProjValueMapper {
@Param
(
"typeState"
)
Integer
typeState
,
@Param
(
"exponentId"
)
Integer
exponentId
,
@Param
(
"dept"
)
String
dept
,
@Param
(
"date"
)
Integer
date
,
@Param
(
"
isBudget"
)
Integer
isBudget
);
@Param
(
"
budgetType"
)
Integer
budgetType
);
}
\ No newline at end of file
bsoft-api/src/main/java/com/bsoft/api/model/reqmodel/QuerySummary.java
View file @
77bf4eb9
...
...
@@ -7,6 +7,8 @@ import lombok.Data;
public
class
QuerySummary
{
@ApiModelProperty
(
value
=
"时间"
,
required
=
true
)
private
Integer
date
;
@ApiModelProperty
(
value
=
"预算类型"
,
required
=
true
)
private
Integer
budgetType
;
@ApiModelProperty
(
value
=
"页面"
)
private
Integer
page
;
...
...
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SerProjValueServiceImpl.java
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
service
.
Impl
;
import
com.bsoft.api.common.enums.BudgetType
;
import
com.bsoft.api.common.enums.ProjectType
;
import
com.bsoft.api.common.enums.StateType
;
import
com.bsoft.api.common.enums.TypeState
;
...
...
@@ -9,7 +10,6 @@ import com.bsoft.api.mapper.SerProjMapper;
import
com.bsoft.api.mapper.SerProjValueMapper
;
import
com.bsoft.api.model.SerPageValueConfig
;
import
com.bsoft.api.model.SerProjValue
;
import
com.bsoft.api.model.SysMenu
;
import
com.bsoft.api.model.reqmodel.AddBudgetValue
;
import
com.bsoft.api.model.reqmodel.BudgetValue
;
import
com.bsoft.api.model.respmodel.*
;
...
...
@@ -51,7 +51,7 @@ public class SerProjValueServiceImpl implements SerProjValueService {
if
(
projectInfo
!=
null
&&
projectInfo
.
size
()
>
0
){
for
(
ProjectInfo
projInfo
:
projectInfo
){
values
=
serProjValueMapper
.
selectValue
(
projectType
,(
Integer
)
enumInfo
.
get
(
"value"
),
projInfo
.
getExponentId
(),
deptCode
,
date
,
null
);
projInfo
.
getExponentId
(),
deptCode
,
date
,
BudgetType
.
NOT
.
getValue
()
);
resultValues
=
getLevelData
(
values
,
BigDecimal
.
valueOf
(
PROJ_TOP_PARENT_ID
));
if
(
resultValues
!=
null
&&
resultValues
.
size
()
>
0
)
projInfo
.
setProjectValues
(
resultValues
);
...
...
@@ -85,8 +85,8 @@ public class SerProjValueServiceImpl implements SerProjValueService {
}
@Override
public
Object
getSummary
(
Integer
date
)
{
List
<
Summary
>
result
=
serProjMapper
.
selectDept
(
date
);
public
Object
getSummary
(
Integer
date
,
Integer
budgetType
)
{
List
<
Summary
>
result
=
serProjMapper
.
selectDept
(
date
,
budgetType
);
if
(
result
!=
null
&&
result
.
size
()
>
0
){
for
(
Summary
summary
:
result
){
summary
.
setProjTypeList
(
new
ArrayList
<>());
...
...
@@ -98,7 +98,7 @@ public class SerProjValueServiceImpl implements SerProjValueService {
projType
=
new
SummaryProjType
();
projType
.
setProjTypeName
(
String
.
valueOf
(
enumInfo
.
get
(
"description"
)));
List
<
SerProjValueResp
>
values
=
serProjValueMapper
.
selectValue
((
Integer
)
enumInfo
.
get
(
"value"
),
null
,
null
,
summary
.
getDeptCode
(),
date
,
1
);
null
,
summary
.
getDeptCode
(),
date
,
budgetType
);
if
(
values
!=
null
)
projType
.
setProject
(
values
);
summary
.
getProjTypeList
().
add
(
projType
);
...
...
@@ -145,9 +145,16 @@ public class SerProjValueServiceImpl implements SerProjValueService {
for
(
SerProjValueResp
data
:
list
){
if
(
data
.
getParent
().
equals
(
parentcode
)){
List
<
SerProjValueResp
>
childList
=
getLevelData
(
list
,
data
.
getProjId
());
childList
=
childList
.
stream
().
sorted
(
Comparator
.
comparing
(
SerProjValueResp:
:
getSort
)).
collect
(
Collectors
.
toList
());
data
.
setChilds
(
childList
);
resultList
.
add
(
data
);
try
{
if
(
data
.
getSort
()
!=
null
){
childList
=
childList
.
stream
().
sorted
(
Comparator
.
comparing
(
SerProjValueResp:
:
getSort
)).
collect
(
Collectors
.
toList
());
}
data
.
setChilds
(
childList
);
resultList
.
add
(
data
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
return
resultList
;
...
...
bsoft-api/src/main/java/com/bsoft/api/service/Impl/SysUserOrgRsServiceImpl.java
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
service
.
Impl
;
import
com.bsoft.api.mapper.DicOrgMapper
;
import
com.bsoft.api.mapper.SysUserOrgRsMapper
;
import
com.bsoft.api.model.SerDepartment
;
import
com.bsoft.api.model.SysUserOrgRs
;
import
com.bsoft.api.service.SysUserOrgRsService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Service
public
class
SysUserOrgRsServiceImpl
implements
SysUserOrgRsService
{
@Resource
private
SysUserOrgRsMapper
sysUserOrgRsMapper
;
@Resource
private
DicOrgMapper
orgMapper
;
@Override
public
int
add
(
SysUserOrgRs
sysUserOrgRs
)
{
...
...
@@ -43,4 +46,11 @@ public class SysUserOrgRsServiceImpl implements SysUserOrgRsService {
public
int
update
(
SysUserOrgRs
sysUserRoleRs
)
{
return
sysUserOrgRsMapper
.
updateByPrimaryKey
(
sysUserRoleRs
);
}
@Override
public
List
<
SerDepartment
>
getUserOrg
(
Long
userId
)
{
List
<
SerDepartment
>
list
=
orgMapper
.
selectDeptByUser
(
userId
);
return
list
;
}
}
bsoft-api/src/main/java/com/bsoft/api/service/SerProjValueService.java
View file @
77bf4eb9
...
...
@@ -12,7 +12,7 @@ public interface SerProjValueService {
boolean
save
(
AddBudgetValue
request
);
Object
getSummary
(
Integer
date
);
Object
getSummary
(
Integer
date
,
Integer
budgetType
);
Object
getData
(
Integer
date
,
Integer
page
);
...
...
bsoft-api/src/main/java/com/bsoft/api/service/SysUserOrgRsService.java
View file @
77bf4eb9
package
com
.
bsoft
.
api
.
service
;
import
com.bsoft.api.model.SerDepartment
;
import
com.bsoft.api.model.SysUserOrgRs
;
import
java.util.List
;
public
interface
SysUserOrgRsService
extends
ServiceBase
<
SysUserOrgRs
>
{
List
<
SerDepartment
>
getUserOrg
(
Long
userId
);
}
bsoft-api/src/main/resources/mapper/DicOrgMapper.xml
View file @
77bf4eb9
...
...
@@ -12,7 +12,15 @@
<result
column=
"ORG_ADDRESS"
jdbcType=
"VARCHAR"
property=
"orgAddress"
/>
<result
column=
"PARENT_ID"
jdbcType=
"DECIMAL"
property=
"parentId"
/>
</resultMap>
<resultMap
id=
"SummaryDept"
type=
"com.bsoft.api.model.SerDepartment"
>
<id
column=
"ID"
jdbcType=
"DECIMAL"
property=
"id"
/>
<result
column=
"CREATE_DATE"
jdbcType=
"TIMESTAMP"
property=
"createDate"
/>
<result
column=
"CREATE_USERID"
jdbcType=
"DECIMAL"
property=
"createUserid"
/>
<result
column=
"STATE"
jdbcType=
"DECIMAL"
property=
"state"
/>
<result
column=
"ORG_ID"
jdbcType=
"VARCHAR"
property=
"orgId"
/>
<result
column=
"KSBM"
jdbcType=
"VARCHAR"
property=
"ksbm"
/>
<result
column=
"KSMC"
jdbcType=
"VARCHAR"
property=
"ksmc"
/>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from DIC_ORG
where ID = #{id,jdbcType=DECIMAL}
...
...
@@ -21,11 +29,11 @@
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
select SEQ_DIC_ORG_ID.nextval from dual
</selectKey>
insert into DIC_ORG (CREATE_DATE, CREATE_USERID, STATE,
ORG_CODE, ORG_NAME, ORG_NO,
ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE,
insert into DIC_ORG (CREATE_DATE, CREATE_USERID, STATE,
ORG_CODE, ORG_NAME, ORG_NO,
ORG_SHORT_NAME, ORG_GROUP, ORG_TYPE,
ORG_ADDRESS, PARENT_ID)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{orgNo,jdbcType=VARCHAR},
#{orgShortName,jdbcType=VARCHAR}, #{orgGroup,jdbcType=VARCHAR}, #{orgType,jdbcType=VARCHAR},
#{orgAddress,jdbcType=VARCHAR}, #{parentId,jdbcType=DECIMAL})
...
...
@@ -65,4 +73,10 @@
where uor.ORG_ID=o.ID and uor.USER_ID= #{userId,jdbcType=DECIMAL}
and uor.STATE = 1 and o.STATE = 1
</select>
<select
id=
"selectDeptByUser"
resultMap=
"SummaryDept"
>
select o.ID,o.ORG_CODE as KSBM,o.ORG_NAME as KSMC
from SYS_USER_ORG_RS rs
join DIC_ORG o on o.id = rs.ORG_ID and rs.STATE = 1
where o.STATE = 1 and o.PARENT_ID != 0 and rs.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
bsoft-api/src/main/resources/mapper/SerProjMapper.xml
View file @
77bf4eb9
...
...
@@ -75,12 +75,17 @@
order by e.SORT
</select>
<select
id=
"selectDept"
resultMap=
"Summary"
>
select DEPT_CODE from SER_PROJ_VALUE
select v.DEPT_CODE
from SER_PROJ_VALUE v
join SER_PROJ p on p.ID =v.PROJ_ID and p.STATE = 1
where 1=1
<if
test=
"date!=null"
>
and "DATE"=#{date}
</if>
GROUP BY DEPT_CODE,SORT
order by SORT
<if
test=
"date!=null"
>
and v."DATE"=#{date}
</if>
<if
test=
"budgetType!=null"
>
and BitAnd(IS_BUDGET,#{budgetType})>0
</if>
GROUP BY v.DEPT_CODE,v.SORT
order by v.SORT
</select>
</mapper>
\ No newline at end of file
bsoft-api/src/main/resources/mapper/SerProjValueMapper.xml
View file @
77bf4eb9
...
...
@@ -126,8 +126,8 @@
<if
test=
"exponentId!=null"
>
AND p.TYPE = #{exponentId,jdbcType=DECIMAL}
</if>
<if
test=
"
isBudget
!=null"
>
AND
p.IS_BUDGET = #{isBudget,jdbcType=DECIMAL}
<if
test=
"
budgetType
!=null"
>
AND
BitAnd(p.IS_BUDGET,#{budgetType})>0
</if>
ORDER BY p.SORT
</select>
...
...
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