Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
Project
Project
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
hubin
long-tern-care-service
Commits
8428183f
Commit
8428183f
authored
Feb 20, 2023
by
zhangwanglin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_ch_master' into dev_nursing_records_20230214
parents
cc0bf2da
c80f0408
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
296 additions
and
34 deletions
+296
-34
ChDisableEvaluateMapper.xml
...ice/src/main/resources/mapper/ChDisableEvaluateMapper.xml
+2
-0
ChDisableApply.java
.../com/hungraim/ltc/pojo/entity/disable/ChDisableApply.java
+4
-0
ChFndDiseaseType.java
...om/hungraim/ltc/pojo/entity/disable/ChFndDiseaseType.java
+5
-0
ChSrvTask.java
...com/hungraim/ltc/pojo/entity/serviceManage/ChSrvTask.java
+6
-0
SystemResourceinterface.java
...graim/ltc/pojo/entity/system/SystemResourceinterface.java
+11
-0
ChFndDiseaseTypeListVO.java
...java/com/hungraim/ltc/pojo/vo/ChFndDiseaseTypeListVO.java
+11
-0
TaskDistributionVO.java
...m/hungraim/ltc/pojo/vo/assessment/TaskDistributionVO.java
+4
-0
SrvTaskInfoVO.java
...va/com/hungraim/ltc/pojo/vo/governance/SrvTaskInfoVO.java
+5
-0
ReqUserInfo.java
...ain/java/com/hungraim/ltc/pojo/vo/system/ReqUserInfo.java
+2
-0
TokenParsingUtil.java
...src/main/java/com/hungraim/ltc/util/TokenParsingUtil.java
+7
-1
AuthorizationManager.java
...m/hungraim/ltc/gateway/security/AuthorizationManager.java
+8
-7
NursingServiceItemsController.java
.../governance/controller/NursingServiceItemsController.java
+44
-0
FndDiseaseTypeMapper.java
...com/hungraim/ltc/governance/dao/FndDiseaseTypeMapper.java
+16
-0
NursingServiceItemsService.java
...im/ltc/governance/service/NursingServiceItemsService.java
+21
-0
NursingServiceItemsServiceImpl.java
...vernance/service/impl/NursingServiceItemsServiceImpl.java
+39
-0
SrvTaskServiceImpl.java
...graim/ltc/governance/service/impl/SrvTaskServiceImpl.java
+12
-0
SrvTaskMapper.xml
...rces/com/hungraim/ltc/governance/mapper/SrvTaskMapper.xml
+3
-1
InitResourceRoleCacheRunner.java
...m/hungraim/ltc/component/InitResourceRoleCacheRunner.java
+1
-1
UserController.java
...va/com/hungraim/ltc/system/controller/UserController.java
+21
-1
SystemInterfaceMapper.java
...va/com/hungraim/ltc/system/dao/SystemInterfaceMapper.java
+9
-4
SystemUserMapper.java
...in/java/com/hungraim/ltc/system/dao/SystemUserMapper.java
+12
-0
ISystemUserService.java
...a/com/hungraim/ltc/system/service/ISystemUserService.java
+9
-0
SystemInterfaceServiceImpl.java
...m/ltc/system/service/impl/SystemInterfaceServiceImpl.java
+32
-19
SystemUserServiceImpl.java
...ngraim/ltc/system/service/impl/SystemUserServiceImpl.java
+12
-0
No files found.
assessment/assessment-service/src/main/resources/mapper/ChDisableEvaluateMapper.xml
View file @
8428183f
...
...
@@ -14,6 +14,8 @@
disable.real_name realName,
task.fcd fcd,
disable.certi_code certiCode,
disable.disease_desc diseaseDesc,
disable.adress_detail operAddress,
report.pol_no polNo,
report.remark remark,
disable.BIRTHDAY birthday,
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/disable/ChDisableApply.java
View file @
8428183f
...
...
@@ -117,6 +117,10 @@ public class ChDisableApply extends PageInfo implements Serializable {
private
Long
srvOrganId
;
/**
* 是否首次申请 初次申请,争议复评,定期复评,变更评定
*/
private
Long
reviewFrequency
;
/**
* 代办人姓名
*/
private
String
operName
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/disable/ChFndDiseaseType.java
View file @
8428183f
package
com
.
hungraim
.
ltc
.
pojo
.
entity
.
disable
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.KeySequence
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
...
...
@@ -8,7 +11,9 @@ import lombok.Data;
*/
@Data
@TableName
(
"CH_FND_DISEASE_TYPE"
)
@KeySequence
(
"SEQ_CH_FND_DISEASE_TYPE"
)
public
class
ChFndDiseaseType
{
@TableId
(
type
=
IdType
.
INPUT
)
private
Integer
diseTypeId
;
private
String
diseTypeCode
;
private
Integer
parDiseTypeId
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/serviceManage/ChSrvTask.java
View file @
8428183f
...
...
@@ -103,5 +103,10 @@ public class ChSrvTask implements Serializable {
*/
private
Long
webEndEmp
;
/**
* 终止计划原因
*/
private
String
endReason
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/system/SystemResourceinterface.java
0 → 100644
View file @
8428183f
package
com
.
hungraim
.
ltc
.
pojo
.
entity
.
system
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
@Data
@TableName
(
"LTC_RESOURCE_INTERFACE"
)
public
class
SystemResourceinterface
{
private
Long
resourceId
;
private
Long
interfaceId
;
}
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/ChFndDiseaseTypeListVO.java
0 → 100644
View file @
8428183f
package
com
.
hungraim
.
ltc
.
pojo
.
vo
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndDiseaseType
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ChFndDiseaseTypeListVO
{
private
List
<
ChFndDiseaseType
>
chFndDiseaseTypes
;
}
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/assessment/TaskDistributionVO.java
View file @
8428183f
...
...
@@ -91,4 +91,8 @@ public class TaskDistributionVO {
private
String
refuseReason
;
//备注
private
String
refuseRemark
;
//诊断详情
private
String
diseaseDesc
;
//现住地址详细地址
private
String
operAddress
;
}
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/governance/SrvTaskInfoVO.java
View file @
8428183f
...
...
@@ -51,6 +51,11 @@ public class SrvTaskInfoVO implements Serializable {
*/
private
String
taskStatus
;
/**
* 终止计划原因
*/
private
String
endReason
;
// /**
// * 服务计划附件
// */
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/system/ReqUserInfo.java
View file @
8428183f
...
...
@@ -22,5 +22,7 @@ public class ReqUserInfo {
private
Long
organId
;
private
Long
srvOrganId
;
private
String
organName
;
private
String
srvOrganName
;
}
common/common-core/src/main/java/com/hungraim/ltc/util/TokenParsingUtil.java
View file @
8428183f
...
...
@@ -11,7 +11,13 @@ public class TokenParsingUtil {
//解析token
String
subToken
=
token
.
substring
(
AuthConstants
.
JWT_PREFIX
.
length
());
String
claims
=
JwtHelper
.
decode
(
subToken
).
getClaims
();
Integer
rid
=
(
Integer
)
JSONObject
.
parseObject
(
claims
).
get
(
id
);
Integer
rid
;
if
(
JSONObject
.
parseObject
(
claims
).
get
(
id
)==
null
||
JSONObject
.
parseObject
(
claims
).
get
(
id
).
equals
(
""
)){
rid
=
0
;
}
else
{
rid
=
(
Integer
)
JSONObject
.
parseObject
(
claims
).
get
(
id
);
}
return
rid
;
}
}
gateway-service/src/main/java/com/hungraim/ltc/gateway/security/AuthorizationManager.java
View file @
8428183f
...
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import
com.alibaba.fastjson.JSONObject
;
import
com.hungraim.ltc.constant.AuthConstants
;
import
com.hungraim.ltc.pojo.entity.system.SystemInterface
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.ListUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -87,14 +88,14 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
String
[]
splitpath
=
path
.
split
(
"/"
);
String
pathNew
=
"/"
+
splitpath
[
1
]
+
"/"
+
splitpath
[
2
]
+
"/*"
;
Set
<
String
>
authorities
=
new
HashSet
<>();
Map
<
String
,
List
<
Long
>>
rolesResources
=
redisTemplate
.
opsForHash
().
entries
(
AuthConstants
.
PERMISSION_ROLES_RESOURCE_KEY
);
Map
<
String
,
List
<
S
ystemInterface
>>
interfaces
=
redisTemplate
.
opsForHash
().
entries
(
AuthConstants
.
PERMISSION_RESOURCE_INTERFACE_KEY
);
List
<
Long
>
resources
=
rolesResources
.
get
(
roleId
);
for
(
Long
resource
:
resources
)
{
List
<
S
ystemInterface
>
systemInterfaces
=
interfaces
.
get
(
resource
.
toString
());
Map
<
String
,
List
<
SystemRoleResource
>>
rolesResources
=
redisTemplate
.
opsForHash
().
entries
(
AuthConstants
.
PERMISSION_ROLES_RESOURCE_KEY
);
Map
<
String
,
List
<
S
tring
>>
interfaces
=
redisTemplate
.
opsForHash
().
entries
(
AuthConstants
.
PERMISSION_RESOURCE_INTERFACE_KEY
);
List
<
SystemRoleResource
>
resources
=
rolesResources
.
get
(
roleId
);
for
(
SystemRoleResource
resource
:
resources
)
{
List
<
S
tring
>
systemInterfaces
=
interfaces
.
get
(
resource
.
getResourceId
()
.
toString
());
if
(
systemInterfaces
!=
null
&&
systemInterfaces
.
size
()
>
0
)
{
for
(
S
ystemInterface
iter
:
systemInterfaces
)
{
if
(
pathMatcher
.
match
(
iter
.
getInterfaceUrl
()
,
pathNew
))
{
for
(
S
tring
iter
:
systemInterfaces
)
{
if
(
pathMatcher
.
match
(
iter
,
pathNew
))
{
authorities
.
addAll
(
Convert
.
toList
(
String
.
class
,
roleId
));
}
}
...
...
governance/src/main/java/com/hungraim/ltc/governance/controller/NursingServiceItemsController.java
View file @
8428183f
package
com
.
hungraim
.
ltc
.
governance
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.governance.dao.FndDiseaseTypeMapper
;
import
com.hungraim.ltc.governance.service.NursingServiceItemsService
;
import
com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndDiseaseType
;
import
com.hungraim.ltc.pojo.entity.disable.ChServiceType
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganProject
;
import
com.hungraim.ltc.pojo.vo.ChFndDiseaseTypeListVO
;
import
com.hungraim.ltc.pojo.vo.disable.ChServiceTypeVo
;
import
com.hungraim.ltc.pojo.vo.disable.SrvModeVo
;
import
com.hungraim.ltc.pojo.vo.governance.OrganProjectVO
;
...
...
@@ -164,4 +168,44 @@ public class NursingServiceItemsController {
return
Result
.
success
(
list
);
}
/**
* 查询疾病类型
*
* @param parDiseTypeId 父疾病类型id 不传值默认查询所有一级疾病类型
*/
@RequestMapping
(
"/fndDiseaseList"
)
public
Result
<
List
<
ChFndDiseaseType
>>
fndDiseaseList
(
String
parDiseTypeId
)
{
List
<
ChFndDiseaseType
>
chFndDiseaseTypes
=
nursingServiceItemsService
.
fndDiseaseList
(
parDiseTypeId
);
return
Result
.
success
(
chFndDiseaseTypes
);
}
/**
* 查询所有疾病数据
*/
@RequestMapping
(
"/fndAllDisease"
)
public
Result
<
List
<
ChFndDiseaseType
>>
fndAllDisease
()
{
List
<
ChFndDiseaseType
>
chFndDiseaseTypes
=
nursingServiceItemsService
.
fndAllDisease
();
return
Result
.
success
(
chFndDiseaseTypes
);
}
/**
* 修改疾病数据
*
* @param chFndDiseaseTypes 疾病修改的信息
* @return 返回执行结果
*/
@PostMapping
(
"/saveDisease"
)
public
Result
saveDisease
(
ChFndDiseaseTypeListVO
chFndDiseaseTypes
)
{
log
.
info
(
"saveDisease"
);
log
.
info
(
JSONObject
.
toJSONString
(
chFndDiseaseTypes
.
getChFndDiseaseTypes
()));
if
(
chFndDiseaseTypes
.
getChFndDiseaseTypes
()
==
null
||
chFndDiseaseTypes
.
getChFndDiseaseTypes
().
size
()
<=
0
)
{
return
Result
.
failed
(
ResultCode
.
REQUEST_PARAM_ERROR
);
}
nursingServiceItemsService
.
saveDisease
(
chFndDiseaseTypes
.
getChFndDiseaseTypes
());
return
Result
.
success
();
}
}
governance/src/main/java/com/hungraim/ltc/governance/dao/FndDiseaseTypeMapper.java
0 → 100644
View file @
8428183f
package
com
.
hungraim
.
ltc
.
governance
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndDiseaseType
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Repository
;
/**
* 疾病类型Mapper
*
* @author czz
*/
@Mapper
@Repository
public
interface
FndDiseaseTypeMapper
extends
BaseMapper
<
ChFndDiseaseType
>
{
}
governance/src/main/java/com/hungraim/ltc/governance/service/NursingServiceItemsService.java
View file @
8428183f
...
...
@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.service;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndDiseaseType
;
import
com.hungraim.ltc.pojo.entity.disable.ChServiceType
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganProject
;
import
com.hungraim.ltc.pojo.vo.disable.ChServiceTypeVo
;
...
...
@@ -42,4 +43,24 @@ public interface NursingServiceItemsService {
void
deleteSrvModel
(
Long
modeId
);
List
<
ChServiceTypeVo
>
queryServiceTypeList
();
/**
* 查询疾病类型
*
* @param parDiseTypeId 父疾病类型id
*/
List
<
ChFndDiseaseType
>
fndDiseaseList
(
String
parDiseTypeId
);
/**
* 查询所有疾病数据
*/
List
<
ChFndDiseaseType
>
fndAllDisease
();
/**
* 修改疾病数据
*
* @param chFndDiseaseTypes
* @return 返回执行结果
*/
void
saveDisease
(
List
<
ChFndDiseaseType
>
chFndDiseaseTypes
);
}
governance/src/main/java/com/hungraim/ltc/governance/service/impl/NursingServiceItemsServiceImpl.java
View file @
8428183f
...
...
@@ -2,12 +2,14 @@ package com.hungraim.ltc.governance.service.impl;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.api.SrvModeFeignService
;
import
com.hungraim.ltc.governance.dao.*
;
import
com.hungraim.ltc.governance.service.NursingServiceItemsService
;
import
com.hungraim.ltc.pojo.entity.SysConfig.ChCfgSrvMode
;
import
com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndDiseaseType
;
import
com.hungraim.ltc.pojo.entity.disable.ChServiceType
;
import
com.hungraim.ltc.pojo.entity.disable.ChServiceTypeDetailed
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganProject
;
...
...
@@ -18,6 +20,7 @@ import com.hungraim.ltc.util.Result;
import
lombok.AllArgsConstructor
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -34,6 +37,7 @@ public class NursingServiceItemsServiceImpl implements NursingServiceItemsServic
private
final
SrvModeFeignService
srvModeFeignService
;
private
final
ServiceTypeMapper
serviceTypeMapper
;
private
final
ServiceTypeDetailedMapper
serviceTypeDetailedMapper
;
private
final
FndDiseaseTypeMapper
fndDiseaseTypeMapper
;
@Override
public
Page
<
OrganProjectVO
>
organProjectList
(
Page
<
OrganProjectVO
>
page
,
String
organIds
,
String
name
,
String
status
)
{
...
...
@@ -130,4 +134,39 @@ public class NursingServiceItemsServiceImpl implements NursingServiceItemsServic
}
return
chServiceTypeVoList
;
}
@Override
public
List
<
ChFndDiseaseType
>
fndAllDisease
()
{
QueryWrapper
<
ChFndDiseaseType
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"IS_VALID"
,
"0"
);
queryWrapper
.
orderByAsc
(
"DISE_TYPE_ID"
);
return
fndDiseaseTypeMapper
.
selectList
(
queryWrapper
);
}
@Override
public
List
<
ChFndDiseaseType
>
fndDiseaseList
(
String
parDiseTypeId
)
{
QueryWrapper
<
ChFndDiseaseType
>
queryWrapper
=
new
QueryWrapper
<>();
//queryWrapper.eq("IS_VALID", "0");
if
(
StringUtils
.
isNotBlank
(
parDiseTypeId
))
{
queryWrapper
.
eq
(
"PAR_DISE_TYPE_ID"
,
parDiseTypeId
);
}
else
{
queryWrapper
.
and
(
wrapper
->
wrapper
.
isNull
(
"PAR_DISE_TYPE_ID"
).
or
().
eq
(
"PAR_DISE_TYPE_ID"
,
""
));
}
return
fndDiseaseTypeMapper
.
selectList
(
queryWrapper
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
saveDisease
(
List
<
ChFndDiseaseType
>
chFndDiseaseTypes
){
//遍历修改的列表
chFndDiseaseTypes
.
stream
().
forEach
(
e
->{
if
(
e
.
getDiseTypeId
()
==
null
){
fndDiseaseTypeMapper
.
insert
(
e
);
}
else
{
fndDiseaseTypeMapper
.
updateById
(
e
);
}
});
}
}
governance/src/main/java/com/hungraim/ltc/governance/service/impl/SrvTaskServiceImpl.java
View file @
8428183f
package
com
.
hungraim
.
ltc
.
governance
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.api.AccountFeignService
;
import
com.hungraim.ltc.api.AttachFeignService
;
...
...
@@ -124,6 +126,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
addOrUpdateSrvTask
(
SrvTaskInfoListVO
param
)
{
log
.
info
(
"制定服务信息:"
+
JSONObject
.
toJSON
(
param
));
String
programId
=
param
.
getProgramId
();
String
disabInfoId
=
param
.
getDisabInfoId
();
List
<
SrvTaskInfoVO
>
taskList
=
param
.
getTaskList
();
...
...
@@ -149,6 +152,15 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// 修改服务计划
chSrvTaskDetailMapper
.
delete
(
new
QueryWrapper
<
ChSrvTaskDetail
>().
eq
(
"srv_task_id"
,
Long
.
parseLong
(
srvTaskId
)));
//删除原来的计划详情
this
.
insertTaskDetail
(
Long
.
parseLong
(
srvTaskId
),
taskDetails
);
//修改服务计划
ChSrvTask
chSrvTask
=
new
ChSrvTask
();
UpdateWrapper
updateWrapper
=
new
UpdateWrapper
();
updateWrapper
.
eq
(
"SRV_TASK_ID"
,
srvTaskId
);
//状态 未分配:0;已分配:1;已终止2
updateWrapper
.
set
(
"STATUS"
,
srvTaskInfoVO
.
getTaskStatus
());
updateWrapper
.
set
(
"END_REASON"
,
srvTaskInfoVO
.
getEndReason
());
srvTaskMapper
.
update
(
null
,
updateWrapper
);
//修改附件
// this.updateAttachs(srvTaskInfoVO.getListAttach(), Long.parseLong(srvTaskId));
}
...
...
governance/src/main/resources/com/hungraim/ltc/governance/mapper/SrvTaskMapper.xml
View file @
8428183f
...
...
@@ -162,7 +162,9 @@
--服务人员资质名称
empType.TYPE_NAME empTypeName,
--服务人员资质名称
task.STATUS taskStatus
task.STATUS taskStatus,
--终止计划原因
task.END_REASON endReason
from ch_srv_task task--服务计划
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join CH_CFG_SRV_EMP_TYPE empType on emp.emp_type_id = empType.EMP_TYPE_ID--护理人员资质
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/component/InitResourceRoleCacheRunner.java
View file @
8428183f
...
...
@@ -25,6 +25,6 @@ public class InitResourceRoleCacheRunner implements CommandLineRunner {
@Override
public
void
run
(
String
...
args
)
{
resourceService
.
refreshPermissionRolesCache
();
//
resourceService.refreshPermissionRolesCache();
}
}
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/UserController.java
View file @
8428183f
...
...
@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.hungraim.ltc.constant.Gender
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndOrgan
;
import
com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan
;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
com.hungraim.ltc.pojo.entity.system.SystemUserRole
;
import
com.hungraim.ltc.pojo.vo.system.ReqUserInfo
;
...
...
@@ -16,6 +18,7 @@ import com.hungraim.ltc.system.service.impl.SystemUserServiceImpl;
import
com.hungraim.ltc.util.CheckStrength
;
import
com.hungraim.ltc.util.Result
;
import
com.hungraim.ltc.util.ResultCode
;
import
com.hungraim.ltc.util.TokenParsingUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
...
...
@@ -172,7 +175,9 @@ public class UserController {
* @return
*/
@PostMapping
(
"/queryUsers"
)
public
Result
queryUsers
(
ReqUserInfo
reqUserInfo
)
{
public
Result
queryUsers
(
@RequestHeader
(
"Authorization"
)
String
token
,
ReqUserInfo
reqUserInfo
)
{
long
srvOrganId
=
TokenParsingUtil
.
TokenParsing
(
token
,
"srvOrganId"
);
long
organId
=
TokenParsingUtil
.
TokenParsing
(
token
,
"organId"
);
QueryWrapper
<
SystemUser
>
systemUserQueryWrapper
=
new
QueryWrapper
<>();
if
(!
StrUtil
.
isBlankIfStr
(
reqUserInfo
.
getName
()))
{
...
...
@@ -185,7 +190,16 @@ public class UserController {
if
(!
StrUtil
.
isBlankIfStr
(
reqUserInfo
.
getEnable
()))
{
systemUserQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
eq
(
SystemUser:
:
getUserStatus
,
reqUserInfo
.
getEnable
()));
}
if
(
srvOrganId
!=
0
)
{
systemUserQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
eq
(
SystemUser:
:
getSrvOrganId
,
srvOrganId
));
}
if
(
organId
!=
0
)
{
systemUserQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
eq
(
SystemUser:
:
getOrganId
,
organId
));
}
List
<
SystemUser
>
users
=
userInfoService
.
list
(
systemUserQueryWrapper
);
List
<
ChFndOrgan
>
chFndOrganList
=
userInfoService
.
fndAllOrgans
();
List
<
ChSrvOrgan
>
chSrvOrganList
=
userInfoService
.
srvOrganLists
();
List
<
ReqUserInfo
>
resUsers
=
users
.
stream
().
map
(
user
->
{
ReqUserInfo
userInfo
=
new
ReqUserInfo
();
userInfo
.
setId
(
user
.
getUserId
());
...
...
@@ -196,6 +210,12 @@ public class UserController {
userInfo
.
setGender
(
Gender
.
MAN
.
getCode
().
equals
(
user
.
getGender
())
?
Gender
.
MAN
.
getDesc
()
:
Gender
.
WOMAN
.
getDesc
());
userInfo
.
setOrganId
(
user
.
getOrganId
());
userInfo
.
setSrvOrganId
(
user
.
getSrvOrganId
());
if
(
userInfo
.
getOrganId
()!=
null
&&
userInfo
.
getOrganId
()>
0
&&
userInfo
.
getSrvOrganId
()!=
null
&&
!
userInfo
.
getSrvOrganId
().
equals
(
"0"
)){
List
<
ChFndOrgan
>
collect
=
chFndOrganList
.
stream
().
filter
(
chFndOrgan
->
chFndOrgan
.
getOrganId
().
equals
(
user
.
getOrganId
().
toString
())).
collect
(
Collectors
.
toList
());
List
<
ChSrvOrgan
>
chSrvOrgans
=
chSrvOrganList
.
stream
().
filter
(
chSrvOrgan
->
chSrvOrgan
.
getSrvOrganId
().
equals
(
user
.
getSrvOrganId
().
intValue
())).
collect
(
Collectors
.
toList
());
userInfo
.
setOrganName
(
collect
.
get
(
0
).
getOrganName
());
userInfo
.
setSrvOrganName
(
chSrvOrgans
.
get
(
0
).
getSrvOrganName
());
}
return
userInfo
;
}).
collect
(
Collectors
.
toList
());
return
Result
.
success
(
resUsers
);
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/dao/SystemInterfaceMapper.java
View file @
8428183f
...
...
@@ -3,6 +3,8 @@ package com.hungraim.ltc.system.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.hungraim.ltc.pojo.entity.system.SystemInterface
;
import
com.hungraim.ltc.pojo.entity.system.SystemResource
;
import
com.hungraim.ltc.pojo.entity.system.SystemResourceinterface
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
org.apache.ibatis.annotations.*
;
import
java.util.List
;
...
...
@@ -14,14 +16,17 @@ import java.util.List;
@Mapper
public
interface
SystemInterfaceMapper
extends
BaseMapper
<
SystemInterface
>
{
@Select
(
"SELECT a.INTERFACE_ID,a.INTERFACE_URL FROM LTC_INTERFACE a,LTC_RESOURCE_INTERFACE e where a.INTERFACE_ID=e.INTERFACE_ID and e.RESOURCE_ID=#{resourceId}"
)
List
<
SystemInterface
>
listInterface
(
Long
resourceId
);
@Select
(
"SELECT a.INTERFACE_ID,a.INTERFACE_URL FROM LTC_INTERFACE a"
)
List
<
SystemInterface
>
listInterface
();
@Select
(
"select c.RESOURCE_ID,c.INTERFACE_ID from LTC_RESOURCE_INTERFACE c"
)
List
<
SystemResourceinterface
>
listResourceInterface
();
@Select
(
"select b.ROLE_ID from LTC_ROLE b"
)
List
<
Long
>
listRole
();
@Select
(
"select c.RESOURCE_ID
from LTC_ROLE_RESOURCE c WHERE c.ROLE_ID=#{roleId}
"
)
List
<
Long
>
listRoleResource
(
Long
roleId
);
@Select
(
"select c.RESOURCE_ID
,c.ROLE_ID from LTC_ROLE_RESOURCE c
"
)
List
<
SystemRoleResource
>
listRoleResource
(
);
}
system/system-admin-service/src/main/java/com/hungraim/ltc/system/dao/SystemUserMapper.java
View file @
8428183f
...
...
@@ -2,8 +2,13 @@ package com.hungraim.ltc.system.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndOrgan
;
import
com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan
;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
/**
* 用户
...
...
@@ -12,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
SystemUserMapper
extends
BaseMapper
<
SystemUser
>
{
@Select
(
"select ORGAN_ID,ORGAN_NAME from CH_FND_ORGAN"
)
List
<
ChFndOrgan
>
fndAllOrgans
();
@Select
(
"select SRV_ORGAN_ID,SRV_ORGAN_NAME from CH_SRV_ORGAN"
)
List
<
ChSrvOrgan
>
srvOrganLists
();
}
system/system-admin-service/src/main/java/com/hungraim/ltc/system/service/ISystemUserService.java
View file @
8428183f
package
com
.
hungraim
.
ltc
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndOrgan
;
import
com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan
;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
java.util.List
;
/**
* @author hubin
*/
public
interface
ISystemUserService
extends
IService
<
SystemUser
>
{
List
<
ChFndOrgan
>
fndAllOrgans
();
List
<
ChSrvOrgan
>
srvOrganLists
();
}
system/system-admin-service/src/main/java/com/hungraim/ltc/system/service/impl/SystemInterfaceServiceImpl.java
View file @
8428183f
...
...
@@ -3,6 +3,8 @@ package com.hungraim.ltc.system.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.hungraim.ltc.constant.AuthConstants
;
import
com.hungraim.ltc.pojo.entity.system.SystemInterface
;
import
com.hungraim.ltc.pojo.entity.system.SystemResourceinterface
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
com.hungraim.ltc.system.dao.SystemInterfaceMapper
;
import
com.hungraim.ltc.system.service.ISystemInterfaceService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -11,6 +13,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author mq
...
...
@@ -34,29 +37,39 @@ public class SystemInterfaceServiceImpl extends ServiceImpl<SystemInterfaceMappe
@Override
public
void
listResourceInterface
()
{
try
{
redisTemplate
.
delete
(
AuthConstants
.
PERMISSION_RESOURCE_INTERFACE_KEY
);
redisTemplate
.
delete
(
AuthConstants
.
PERMISSION_ROLES_RESOURCE_KEY
);
Map
<
String
,
List
<
Long
>>
roleResourcesMap
=
new
TreeMap
<>();
Map
<
String
,
List
<
SystemInterface
>>
stringStringHashMap
=
new
HashMap
<>();
Map
<
String
,
List
<
SystemRoleResource
>>
roleResourcesMap
=
new
TreeMap
<>();
Map
<
String
,
List
<
String
>>
stringStringHashMap
=
new
HashMap
<>();
//角色数据
List
<
Long
>
roles
=
systemInterfaceMapper
.
listRole
();
String
roleId
;
for
(
Long
role
:
roles
)
{
List
<
Long
>
roleResources
=
systemInterfaceMapper
.
listRoleResource
(
role
);
//保存资源和接口
for
(
Long
roleResource:
roleResources
){
List
<
SystemInterface
>
systemInterfaces
=
systemInterfaceMapper
.
listInterface
(
roleResource
);
stringStringHashMap
.
put
(
roleResource
.
toString
(),
systemInterfaces
);
}
// 转换 roles -> ROLE_{roleId}
roleId
=
AuthConstants
.
AUTHORITY_PREFIX
+
role
;
//保存角色和资源
roleResourcesMap
.
put
(
roleId
,
roleResources
);
}
//角色和资源数据
List
<
SystemRoleResource
>
roleResources
=
systemInterfaceMapper
.
listRoleResource
();
//资源和接口数据
List
<
SystemResourceinterface
>
resourceInterface
=
systemInterfaceMapper
.
listResourceInterface
();
//接口数据
List
<
SystemInterface
>
systemInterfaces
=
systemInterfaceMapper
.
listInterface
();
roles
.
stream
().
forEach
(
role
->
{
//角色和资源数据
List
<
SystemRoleResource
>
roleResourceList
=
roleResources
.
stream
().
filter
(
roleResource
->
roleResource
.
getRoleId
().
equals
(
role
)).
collect
(
Collectors
.
toList
());
roleResourceList
.
stream
().
forEach
(
roleResource
->
{
//资源和接口数据
List
<
SystemResourceinterface
>
resourceinterfaceList
=
resourceInterface
.
stream
().
filter
(
role2
->
role2
.
getResourceId
().
equals
(
roleResource
.
getResourceId
())).
collect
(
Collectors
.
toList
());
List
<
String
>
systemResourceinterfaces
=
new
ArrayList
<>();
resourceinterfaceList
.
stream
().
forEach
(
resourceinterface
->{
List
<
SystemInterface
>
collect
=
systemInterfaces
.
stream
().
filter
(
role2
->
role2
.
getInterfaceId
().
equals
(
resourceinterface
.
getInterfaceId
())).
collect
(
Collectors
.
toList
());
systemResourceinterfaces
.
add
(
collect
.
get
(
0
).
getInterfaceUrl
());
});
//资源和接口
stringStringHashMap
.
put
(
roleResource
.
getResourceId
().
toString
(),
systemResourceinterfaces
);
});
//角色和资源
roleResourcesMap
.
put
(
AuthConstants
.
AUTHORITY_PREFIX
+
role
.
toString
(),
roleResourceList
);
});
redisTemplate
.
opsForHash
().
putAll
(
AuthConstants
.
PERMISSION_ROLES_RESOURCE_KEY
,
roleResourcesMap
);
redisTemplate
.
opsForHash
().
putAll
(
AuthConstants
.
PERMISSION_RESOURCE_INTERFACE_KEY
,
stringStringHashMap
);
}
catch
(
RuntimeException
e
){
e
.
printStackTrace
();
}
}
}
system/system-admin-service/src/main/java/com/hungraim/ltc/system/service/impl/SystemUserServiceImpl.java
View file @
8428183f
...
...
@@ -2,6 +2,8 @@ package com.hungraim.ltc.system.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.hungraim.ltc.pojo.entity.disable.ChFndOrgan
;
import
com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan
;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
com.hungraim.ltc.system.dao.SystemUserMapper
;
import
com.hungraim.ltc.system.dao.SystemUserRoleMapper
;
...
...
@@ -9,6 +11,7 @@ import com.hungraim.ltc.system.service.ISystemUserService;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author hubin
...
...
@@ -23,4 +26,13 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
private
SystemUserRoleMapper
userRoleMapper
;
@Override
public
List
<
ChFndOrgan
>
fndAllOrgans
()
{
return
userMapper
.
fndAllOrgans
();
}
@Override
public
List
<
ChSrvOrgan
>
srvOrganLists
()
{
return
userMapper
.
srvOrganLists
();
}
}
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