Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
c7120aaf
提交
c7120aaf
authored
10月 16, 2020
作者:
133
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[清退][user][统计] 修改了清退、用户以及添加了统计模拟接口
上级
4b7af7d5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
567 行增加
和
28 行删除
+567
-28
SendBackServiceImpl.java
...dev/device/sendback/service/impl/SendBackServiceImpl.java
+0
-0
pom.xml
dev-statistical/pom.xml
+30
-0
StatisticalController.java
...ykj/dev/statistical/controller/StatisticalController.java
+99
-0
package-info.java
.../src/main/java/com/tykj/dev/statistical/package-info.java
+2
-0
Alarm.java
...ical/src/main/java/com/tykj/dev/statistical/vo/Alarm.java
+27
-0
AlarmSituation.java
...main/java/com/tykj/dev/statistical/vo/AlarmSituation.java
+27
-0
BusinessSituation.java
...n/java/com/tykj/dev/statistical/vo/BusinessSituation.java
+71
-0
DevLifeSector.java
.../main/java/com/tykj/dev/statistical/vo/DevLifeSector.java
+50
-0
DevNum.java
...cal/src/main/java/com/tykj/dev/statistical/vo/DevNum.java
+21
-0
DevProvinceSector.java
...n/java/com/tykj/dev/statistical/vo/DevProvinceSector.java
+50
-0
SelfInspection.java
...main/java/com/tykj/dev/statistical/vo/SelfInspection.java
+25
-0
UserGeneralSituation.java
...ava/com/tykj/dev/statistical/vo/UserGeneralSituation.java
+32
-0
Verification.java
...c/main/java/com/tykj/dev/statistical/vo/Verification.java
+25
-0
TaskController.java
...a/com/tykj/dev/device/task/controller/TaskController.java
+49
-0
TaskDao.java
...ain/java/com/tykj/dev/device/task/repository/TaskDao.java
+9
-0
WorkHandoverServiceImpl.java
...ev/device/train/service/impl/WorkHandoverServiceImpl.java
+8
-1
pom.xml
dev-user/pom.xml
+0
-4
MyFilter.java
...c/main/java/com/tykj/dev/device/user/config/MyFilter.java
+0
-18
MyUserDetailsServiceImpl.java
...tykj/dev/device/user/config/MyUserDetailsServiceImpl.java
+4
-1
SecurityConfig.java
.../java/com/tykj/dev/device/user/config/SecurityConfig.java
+2
-1
UrlFilterInvocationSecurityMetadataSource.java
...config/url/UrlFilterInvocationSecurityMetadataSource.java
+1
-1
RoleController.java
...kj/dev/device/user/subject/controller/RoleController.java
+8
-0
UnitsController.java
...j/dev/device/user/subject/controller/UnitsController.java
+3
-0
UserRoleDao.java
...ava/com/tykj/dev/device/user/subject/dao/UserRoleDao.java
+2
-0
RoleServiceImpl.java
...dev/device/user/subject/service/impl/RoleServiceImpl.java
+11
-0
UnitsServiceImpl.java
...ev/device/user/subject/service/impl/UnitsServiceImpl.java
+9
-1
pom.xml
pom.xml
+2
-1
没有找到文件。
dev-sendback/src/main/java/com/tykj/dev/device/sendback/service/impl/SendBackServiceImpl.java
浏览文件 @
c7120aaf
差异被折叠。
点击展开。
dev-statistical/pom.xml
0 → 100644
浏览文件 @
c7120aaf
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
equip
</artifactId>
<groupId>
com.tykj
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
dev-statistical
</artifactId>
<dependencies>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-user
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
misc
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
config
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-statistical/src/main/java/com/tykj/dev/statistical/controller/StatisticalController.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
controller
;
/**
* @author zjm
* @version 1.0.0
* @ClassName StatisticalController.java
* @Description TODO
* @createTime 2020年10月16日 14:53:00
*/
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.statistical.vo.*
;
import
io.swagger.annotations.Api
;
import
org.springframework.http.RequestEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@Api
(
tags
=
"统计业务模块"
,
description
=
"统计相关接口"
)
@AutoDocument
@RequestMapping
(
"/statistical"
)
public
class
StatisticalController
{
/**
* 查询各市的装备数量
* @return 各市装备对象集合
*/
@GetMapping
(
"/devNum"
)
public
ResponseEntity
selectDevNum
(){
List
<
DevNum
>
nums
=
new
ArrayList
<>();
return
ResponseEntity
.
ok
(
nums
);
}
/**
* 查询各市装备生命状态数量
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/StateofLife"
)
public
ResponseEntity
selectStateofLife
(){
List
<
DevLifeSector
>
nums
=
new
ArrayList
<>();
return
ResponseEntity
.
ok
(
nums
);
}
/**
* 查询各市自查情况数量
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/selfInspection/{type}"
)
public
ResponseEntity
selectSelfInspection
(
@PathVariable
Integer
type
){
List
<
SelfInspection
>
nums
=
new
ArrayList
<>();
return
ResponseEntity
.
ok
(
nums
);
}
/**
* 查询各市核查情况数量
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/selfInspection/{type}"
)
public
ResponseEntity
selectVerification
(
@PathVariable
Integer
type
){
List
<
Verification
>
nums
=
new
ArrayList
<>();
return
ResponseEntity
.
ok
(
nums
);
}
/**
* 查询专管员概述
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/generalSituation"
)
public
ResponseEntity
selectGeneralSituation
(){
return
ResponseEntity
.
ok
(
new
UserGeneralSituation
());
}
/**
* 查询告警情况
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/alarmSituation"
)
public
ResponseEntity
selectAlarmSituation
(){
return
ResponseEntity
.
ok
(
new
AlarmSituation
());
}
/**
* 查询业务情况
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/businessSituation/{type}"
)
public
ResponseEntity
selectBusinessSituation
(
@PathVariable
Integer
type
){
return
ResponseEntity
.
ok
(
new
BusinessSituation
());
}
}
dev-statistical/src/main/java/com/tykj/dev/statistical/package-info.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
;
\ No newline at end of file
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/Alarm.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName Alarm.java
* @Description 告警详情统计
* @createTime 2020年10月16日 10:38:00
*/
public
class
Alarm
{
/**
* 市 名称
*/
private
String
areaName
;
/**
* 进出记录
*/
private
Integer
accessCount
;
/**
* 盘点记录
*/
private
Integer
inventoryCount
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/AlarmSituation.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AlarmSituation.java
* @Description 告警概况
* @createTime 2020年10月16日 13:50:00
*/
public
class
AlarmSituation
{
/**
* 总数
*/
private
Integer
alarmCount
;
/**
* 出入
*/
private
Integer
inOutConut
;
/**
*盘库
*/
private
Integer
inventoryCount
;
/**
* 未处理
*/
private
Integer
untreatedCount
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/BusinessSituation.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName BusinessSituation.java
* @Description TODO
* @createTime 2020年10月16日 13:21:00
*/
public
class
BusinessSituation
{
/**
* 配发
*/
private
Integer
withCount
;
/**
* 清退
*/
private
Integer
sendRepelCount
;
/**
* 自查
*/
private
Integer
selfInspection
;
/**
* 核查
*/
private
Integer
verification
;
/**
* 培训
*/
private
Integer
train
;
/**
* 决算
*/
private
Integer
finalAccounts
;
/**
* 入库
*/
private
Integer
putStorage
;
/**
* 申请
*/
private
Integer
apply
;
/**
* 列装
*/
private
Integer
fielding
;
/**
* 退装
*/
private
Integer
backPack
;
/**
* 销毁
*/
private
Integer
destruction
;
/**
* 维修
*/
private
Integer
maintenance
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/DevLifeSector.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevLifeSector.java
* @Description 各市扇形生命状态统计
* @createTime 2020年10月16日 09:55:00
*/
public
class
DevLifeSector
{
/**
* 市名称
*/
private
String
areaName
;
/**
*在库数量
*/
private
Integer
inStock
;
/**
* 维修数量
*/
private
Integer
maintenanceConut
;
/**
* 报废数量
*/
private
Integer
scrapCount
;
/**
* 退役
*/
private
Integer
retiredCount
;
/**
* 销毁
*/
private
Integer
destructionCount
;
/**
* 使用
*/
private
Integer
useCount
;
/**
* 运输、锁定
*/
private
Integer
lockCount
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/DevNum.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevNum.java
* @Description 统计分析 市级 本市装备数量
* @createTime 2020年10月15日 10:35:00
*/
public
class
DevNum
{
/**
* 区域名称
*/
private
String
areaName
;
/**
* 区域装备总数
*/
private
Integer
conut
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/DevProvinceSector.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevLifeSector.java
* @Description 省扇形生命状态统计
* @createTime 2020年10月16日 09:55:00
*/
public
class
DevProvinceSector
{
/**
* 市名称
*/
private
String
areaName
;
/**
*在库数量
*/
private
Integer
inStock
;
/**
* 维修数量
*/
private
Integer
maintenanceConut
;
/**
* 报废数量
*/
private
Integer
scrapCount
;
/**
* 退役
*/
private
Integer
retiredCount
;
/**
* 销毁
*/
private
Integer
destructionCount
;
/**
* 使用
*/
private
Integer
useCount
;
/**
* 运输、锁定
*/
private
Integer
lockCount
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/SelfInspection.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName SelfInspection.java
* @Description 自查各市完成情况
* @createTime 2020年10月16日 10:30:00
*/
public
class
SelfInspection
{
/**
* 市 名称
*/
private
String
areaName
;
/**
* 完成数量
*/
private
Integer
completeCount
;
/**
* 未完成数量
*/
private
Integer
noCompleteCount
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/UserGeneralSituation.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
import
java.util.List
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UserGeneralSituation.java
* @Description 用户概况
* @createTime 2020年10月16日 13:40:00
*/
public
class
UserGeneralSituation
{
/**
* 专管员数量
*/
private
Integer
userCount
;
/**
* 已培训数量
*/
private
Integer
hadBeenTrainingCount
;
/**
* 未培训数量
*/
private
Integer
noHadBeenTrainingCount
;
/**
* 未培训人员id
*/
private
List
<
Integer
>
noUserIds
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/Verification.java
0 → 100644
浏览文件 @
c7120aaf
package
com
.
tykj
.
dev
.
statistical
.
vo
;
/**
* @author zjm
* @version 1.0.0
* @ClassName SelfInspection.java
* @Description 核查各市完成情况
* @createTime 2020年10月16日 10:30:00
*/
public
class
Verification
{
/**
* 市 名称
*/
private
String
areaName
;
/**
* 完成数量
*/
private
Integer
completeCount
;
/**
* 未完成数量
*/
private
Integer
noCompleteCount
;
}
dev-task/src/main/java/com/tykj/dev/device/task/controller/TaskController.java
浏览文件 @
c7120aaf
...
...
@@ -12,6 +12,7 @@ import com.tykj.dev.device.task.subject.vo.TaskTopVo;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.utils.TaskUtils
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
...
...
@@ -125,4 +126,52 @@ public class TaskController {
.
collect
(
Collectors
.
toList
());
return
ResultUtil
.
success
(
taskLogUserVoList
);
}
@ApiOperation
(
value
=
"根据bill查询业务日志"
,
notes
=
"可以通过这个接口查询查询业务日志"
)
@GetMapping
(
"/manage/detail/log/bill/{id}"
)
public
ResponseEntity
selectBillLog
(
@PathVariable
(
"id"
)
int
bill
)
{
Task
taskEn
=
taskDao
.
findByBillIdAndBusinessType
(
bill
,
BusinessEnum
.
CONFIRM_CHECK_STAT
.
id
).
get
();
//添加当前业务日志
List
<
TaskLogUserVo
>
taskLogUserVos
=
taskLogService
.
getByTaskId
(
taskEn
.
getId
());
//查询所有子业务
List
<
TaskBto
>
taskBtos
=
taskDao
.
findAll
().
stream
()
.
filter
(
task
->
task
.
getNodeIdDetail
()
!=
null
&&
task
.
getNodeIdDetail
().
contains
(
"."
+
taskEn
.
getId
()
+
"."
))
.
map
(
Task:
:
parse2Bto
)
.
collect
(
Collectors
.
toList
());
//添加子业务日志
if
(
taskBtos
.
size
()
>
0
)
{
taskBtos
.
forEach
(
taskBto
->
taskLogUserVos
.
addAll
(
taskLogService
.
getByTaskId
(
taskBto
.
getId
())));
}
//按日志时间排序
List
<
TaskLogUserVo
>
taskLogUserVoList
=
taskLogUserVos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
TaskLogUserVo:
:
getCreateTime
).
reversed
())
.
collect
(
Collectors
.
toList
());
return
ResultUtil
.
success
(
taskLogUserVoList
);
}
@ApiOperation
(
value
=
"核查详情查询业务日志"
,
notes
=
"可以通过这个接口查询查询业务日志"
)
@GetMapping
(
"/manage/detail/log/bill/details/{id}"
)
public
ResponseEntity
selectBillLog7
(
@PathVariable
(
"id"
)
int
bill
)
{
Task
taskEn
=
taskDao
.
findByBillIdAndBusinessType
(
bill
,
BusinessEnum
.
CONFIRM_CHECK_DETAIL
.
id
).
get
();
//添加当前业务日志
List
<
TaskLogUserVo
>
taskLogUserVos
=
taskLogService
.
getByTaskId
(
taskEn
.
getId
());
//查询所有子业务
List
<
TaskBto
>
taskBtos
=
taskDao
.
findAll
().
stream
()
.
filter
(
task
->
task
.
getNodeIdDetail
()
!=
null
&&
task
.
getNodeIdDetail
().
contains
(
"."
+
taskEn
.
getId
()
+
"."
))
.
map
(
Task:
:
parse2Bto
)
.
collect
(
Collectors
.
toList
());
//添加子业务日志
if
(
taskBtos
.
size
()
>
0
)
{
taskBtos
.
forEach
(
taskBto
->
taskLogUserVos
.
addAll
(
taskLogService
.
getByTaskId
(
taskBto
.
getId
())));
}
//按日志时间排序
List
<
TaskLogUserVo
>
taskLogUserVoList
=
taskLogUserVos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
TaskLogUserVo:
:
getCreateTime
).
reversed
())
.
collect
(
Collectors
.
toList
());
return
ResultUtil
.
success
(
taskLogUserVoList
);
}
}
dev-task/src/main/java/com/tykj/dev/device/task/repository/TaskDao.java
浏览文件 @
c7120aaf
...
...
@@ -29,6 +29,15 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
*/
List
<
Task
>
findAllByBillIdAndBusinessTypeAndBillStatus
(
Integer
billId
,
Integer
businessType
,
Integer
billStatus
);
/**
* 根据账单id、业务类型、任务状态查询task
*
* @param billId 账单id
* @param businessType 业务类型
*/
List
<
Task
>
findAllByBillIdAndBusinessType
(
Integer
billId
,
Integer
businessType
);
/**
* 根据账单id、业务类型、以及父id为null
...
...
dev-train/src/main/java/com/tykj/dev/device/train/service/impl/WorkHandoverServiceImpl.java
浏览文件 @
c7120aaf
...
...
@@ -13,11 +13,13 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import
com.tykj.dev.device.train.service.TrainTaskService
;
import
com.tykj.dev.device.train.service.WorkHandoverService
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.service.UserService
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
...
...
@@ -45,6 +47,9 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired
TrainTaskService
trainTaskService
;
@Autowired
UserService
userService
;
@Override
public
WorkHandover
createWorkHandover
(
WorkHandoverAddVo
workHandoverAddVo
,
SecurityUser
securityUser
)
{
log
.
info
(
"[workHandover] 新建工作交接"
);
...
...
@@ -52,7 +57,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
WorkHandover
workHandover
=
workHandoverDao
.
save
(
workHandoverAddVo
.
toWorkHandover
());
List
<
Integer
>
integers
=
new
ArrayList
<>();
integers
.
add
(
securityUser
.
getCurrentUserInfo
().
getUserId
());
TaskBto
task
=
taskService
.
start
(
new
TaskBto
(
StatusEnum
.
WORKHANDOVER1011
.
id
,
"工作交接"
,
null
,
null
,
workHandover
.
getWorkHandoverId
(),
BusinessEnum
.
WORK_HANDOVER
.
id
,
securityUser
.
getCurrentUserInfo
().
getUnitsId
(),
0
,
null
,
integers
));
taskService
.
start
(
new
TaskBto
(
StatusEnum
.
WORKHANDOVER1011
.
id
,
"工作交接"
,
null
,
null
,
workHandover
.
getWorkHandoverId
(),
BusinessEnum
.
WORK_HANDOVER
.
id
,
securityUser
.
getCurrentUserInfo
().
getUnitsId
(),
0
,
null
,
integers
));
return
workHandover
;
}
...
...
@@ -76,6 +81,8 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
//推入完结状态
TaskBto
taskBto
=
trainTaskService
.
selectFatherIsNullAndBillidAndBillType
(
workHandover
.
getWorkHandoverId
(),
BusinessEnum
.
WORK_HANDOVER
.
id
);
taskService
.
moveToEnd
(
taskBto
);
//把交接人账号状态改为冻结
return
workHandover
;
}
...
...
dev-user/pom.xml
浏览文件 @
c7120aaf
...
...
@@ -20,10 +20,6 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
...
...
dev-user/src/main/java/com/tykj/dev/device/user/config/MyFilter.java
浏览文件 @
c7120aaf
...
...
@@ -52,28 +52,10 @@ public class MyFilter extends UsernamePasswordAuthenticationFilter {
SecurityUser
principal
=
new
SecurityUser
();
principal
.
setUsername
(
username
);
sessionRegistry
.
registerNewSession
(
request
.
getSession
(
true
).
getId
(),
principal
);
System
.
out
.
println
(
"___"
+
request
.
getSession
(
true
).
getId
());
return
this
.
getAuthenticationManager
().
authenticate
(
authRequest
);
// if (request.getContentType().equals(MediaType.APPLICATION_JSON_UTF8_VALUE) || request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE)) {
// ObjectMapper mapper = new ObjectMapper();
// UsernamePasswordAuthenticationToken authRequest = null;
// try (InputStream is = request.getInputStream()) {
// Map<String, String> authenticationBean = mapper.readValue(is, Map.class);
// authRequest = new UsernamePasswordAuthenticationToken(authenticationBean.get("username"), authenticationBean.get("password"));
// } catch (IOException e) {
// e.printStackTrace();
// authRequest = new UsernamePasswordAuthenticationToken("", "");
// } finally {
// setDetails(request, authRequest);
// SecurityUser principal = new SecurityUser();
// principal.setUsername(username);
// sessionRegistry.registerNewSession(request.getSession(true).getId(), principal);
// return this.getAuthenticationManager().authenticate(authRequest);
// }
}
else
{
SecurityUser
principal
=
new
SecurityUser
();
principal
.
setUsername
(
request
.
getParameter
(
"username"
));
System
.
out
.
println
(
"___"
+
request
.
getSession
(
true
).
getId
());
sessionRegistry
.
registerNewSession
(
request
.
getSession
(
true
).
getId
(),
principal
);
return
super
.
attemptAuthentication
(
request
,
response
);
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/config/MyUserDetailsServiceImpl.java
浏览文件 @
c7120aaf
...
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.UserRole
;
import
com.tykj.dev.device.user.subject.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
...
...
@@ -18,6 +19,7 @@ import java.util.List;
* @author zjm
*/
@Service
@Slf4j
public
class
MyUserDetailsServiceImpl
implements
UserDetailsService
{
@Autowired
PermissionsService
permissionsService
;
...
...
@@ -34,7 +36,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
@Override
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
System
.
out
.
println
(
"userService验证:"
+
username
);
SecurityUser
securityUser
=
new
SecurityUser
();
User
user
=
userService
.
findByUserName
(
username
);
if
(
user
==
null
)
{
...
...
@@ -72,6 +74,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
securityUser
.
setCurrentUserInfo
(
user
);
securityUser
.
setRoleList
(
roles
);
securityUser
.
setUsername
(
username
);
log
.
info
(
"登入成功:{}"
,
username
);
return
securityUser
;
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/config/SecurityConfig.java
浏览文件 @
c7120aaf
...
...
@@ -94,14 +94,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
configuration
.
setAllowedHeaders
(
Arrays
.
asList
(
"Origin"
,
"X-Requested-With"
,
"Content-Type"
,
"Accept"
));
configuration
.
setMaxAge
(
3600L
);
configuration
.
setAllowCredentials
(
true
);
// configuration.addExposedHeader("Location");
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
source
.
registerCorsConfiguration
(
"/**"
,
configuration
);
return
source
;
}
@Override
public
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
httpSecurity
.
cors
()
.
and
()
...
...
dev-user/src/main/java/com/tykj/dev/device/user/config/url/UrlFilterInvocationSecurityMetadataSource.java
浏览文件 @
c7120aaf
...
...
@@ -51,7 +51,7 @@ public class UrlFilterInvocationSecurityMetadataSource implements FilterInvocati
String
requestUrl
=
((
FilterInvocation
)
object
).
getRequestUrl
();
// TODO 忽略url请放在此处进行过滤放行
AntPathMatcher
antPathMatcher
=
new
AntPathMatcher
();
if
(
"/userLogin"
.
equals
(
requestUrl
))
{
if
(
"/userLogin"
.
equals
(
requestUrl
)
||
"/swagger-ui.html"
.
equals
(
requestUrl
)
)
{
return
null
;
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/RoleController.java
浏览文件 @
c7120aaf
...
...
@@ -61,6 +61,14 @@ public class RoleController {
}
@GetMapping
(
value
=
"/delete/{roleId}"
)
@ApiOperation
(
value
=
"删除角色"
,
notes
=
"成功返回ok"
)
public
ResponseEntity
deleteRoleId
(
@PathVariable
Integer
roleId
)
{
return
ResponseEntity
.
ok
(
roleService
.
delete
(
roleId
));
}
@GetMapping
(
value
=
"/summary/page/{page}/{size}"
)
@ApiOperation
(
value
=
"查询角色列表"
,
notes
=
"成功返回角色对象"
)
public
ResponseEntity
selectPage
(
@PathVariable
Integer
page
,
@PathVariable
Integer
size
)
{
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/UnitsController.java
浏览文件 @
c7120aaf
...
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
...
...
@@ -25,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
@AutoDocument
@Api
(
tags
=
"用户模块"
,
description
=
"提供用户相关的接口"
)
@RequestMapping
(
"/units"
)
@Slf4j
public
class
UnitsController
{
@Autowired
UnitsService
unitsService
;
...
...
@@ -50,6 +52,7 @@ public class UnitsController {
@GetMapping
(
value
=
"/area"
)
@ApiOperation
(
value
=
"根据等级查询对应等级的单位集合"
,
notes
=
"单位集合"
)
public
ResponseEntity
selectOrganizationUnits
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
log
.
info
(
"数据星系:{}"
,
securityUser
);
return
ResponseEntity
.
ok
(
unitsService
.
findListAreaUnitsVo
(
securityUser
));
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/dao/UserRoleDao.java
浏览文件 @
c7120aaf
...
...
@@ -10,4 +10,6 @@ import java.util.List;
@Repository
public
interface
UserRoleDao
extends
JpaRepository
<
UserRole
,
Integer
>,
JpaSpecificationExecutor
<
UserRole
>
{
List
<
UserRole
>
findAllByUserId
(
Integer
userId
);
void
deleteAllByRoleId
(
Integer
roleId
);
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/RoleServiceImpl.java
浏览文件 @
c7120aaf
...
...
@@ -2,11 +2,14 @@ package com.tykj.dev.device.user.subject.service.impl;
import
com.tykj.dev.device.user.base.ret.RolePage
;
import
com.tykj.dev.device.user.subject.dao.RoleDao
;
import
com.tykj.dev.device.user.subject.dao.RolePermissionsDao
;
import
com.tykj.dev.device.user.subject.dao.UserRoleDao
;
import
com.tykj.dev.device.user.subject.entity.Role
;
import
com.tykj.dev.device.user.subject.entity.RolePermissions
;
import
com.tykj.dev.device.user.subject.service.PermissionsService
;
import
com.tykj.dev.device.user.subject.service.RolePermissionsService
;
import
com.tykj.dev.device.user.subject.service.RoleService
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -36,6 +39,12 @@ public class RoleServiceImpl implements RoleService {
@Autowired
PermissionsService
permissionsService
;
@Autowired
UserRoleDao
userRoleDao
;
@Autowired
RolePermissionsDao
rolePermissionsDao
;
@Override
public
Role
save
(
Role
role
)
{
return
roleDao
.
save
(
role
);
...
...
@@ -44,6 +53,8 @@ public class RoleServiceImpl implements RoleService {
@Override
public
boolean
delete
(
Integer
id
)
{
roleDao
.
deleteById
(
id
);
rolePermissionsDao
.
deleteAllByRoleId
(
id
);
userRoleDao
.
deleteAllByRoleId
(
id
);
return
true
;
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UnitsServiceImpl.java
浏览文件 @
c7120aaf
...
...
@@ -9,6 +9,7 @@ import com.tykj.dev.device.user.subject.entity.Area;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -25,6 +26,7 @@ import java.util.stream.Collectors;
* @createTime 2020年07月28日 10:14:00
*/
@Service
@Slf4j
public
class
UnitsServiceImpl
implements
UnitsService
{
@Autowired
UnitsDao
unitsDao
;
...
...
@@ -45,7 +47,9 @@ public class UnitsServiceImpl implements UnitsService {
public
List
<
AreaVo
>
findListAreaUnitsVo
(
SecurityUser
securityUser
)
{
List
<
AreaVo
>
areaVos
=
new
ArrayList
<>();
//查询当前登入用户所属单位 的区域
log
.
info
(
"数据:"
+
securityUser
.
getUsername
());
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()==
1
){
int
i
=
10000
;
...
...
@@ -136,7 +140,11 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
Units
findByAreaId
(
Integer
unitsId
)
{
return
unitsDao
.
findAllByAreaId
(
areaDao
.
findById
(
findById
(
unitsId
).
getAreaId
()).
get
().
getFatherId
()).
get
(
0
);
return
unitsDao
.
findAllByAreaId
(
areaDao
.
findById
(
findById
(
unitsId
).
getAreaId
()
).
get
().
getFatherId
()
).
get
(
0
);
}
...
...
pom.xml
浏览文件 @
c7120aaf
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.1.
1
4.RELEASE
</version>
<version>
2.1.4.RELEASE
</version>
</parent>
<modules>
<module>
dev-socket
</module>
...
...
@@ -41,6 +41,7 @@
<module>
dev-train
</module>
<module>
dev-user
</module>
<module>
dev-usereport
</module>
<module>
dev-statistical
</module>
</modules>
<properties>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论