Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
f564cc3c
Commit
f564cc3c
authored
Mar 20, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改注解
parent
db1d5bae
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
25 deletions
+109
-25
UserEmpowerInterceptor.java
...s/boot/module/hygf/api/config/UserEmpowerInterceptor.java
+59
-13
UserLimitsAdvice.java
...in/amos/boot/module/hygf/api/config/UserLimitsAdvice.java
+12
-5
UserUnitInformationDto.java
...amos/boot/module/hygf/api/dto/UserUnitInformationDto.java
+1
-2
StdUserEmpower.java
...join/amos/boot/module/hygf/api/entity/StdUserEmpower.java
+9
-1
UserEmpowerMapper.java
...n/amos/boot/module/hygf/api/mapper/UserEmpowerMapper.java
+7
-0
PersonnelBusinessMapper.xml
...c/main/resources/mapper/mysql/PersonnelBusinessMapper.xml
+0
-1
UserEmpowerMapper.xml
...api/src/main/resources/mapper/mysql/UserEmpowerMapper.xml
+18
-0
PowerStationController.java
...ot/module/hygf/biz/controller/PowerStationController.java
+3
-3
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/UserEmpowerInterceptor.java
View file @
f564cc3c
...
@@ -31,8 +31,9 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -31,8 +31,9 @@ public class UserEmpowerInterceptor implements Interceptor {
@Override
@Override
public
Object
intercept
(
Invocation
invocation
)
throws
Throwable
{
public
Object
intercept
(
Invocation
invocation
)
throws
Throwable
{
StdUserEmpower
orgCode
=
UserEmpowerThreadLocal
.
getDataAuthRule
();
if
(
orgCode
.
isFlag
()){
try
{
try
{
StatementHandler
statementHandler
=
PluginUtils
.
realTarget
(
invocation
.
getTarget
());
StatementHandler
statementHandler
=
PluginUtils
.
realTarget
(
invocation
.
getTarget
());
MetaObject
metaObject
=
SystemMetaObject
.
forObject
(
statementHandler
);
MetaObject
metaObject
=
SystemMetaObject
.
forObject
(
statementHandler
);
...
@@ -43,6 +44,8 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -43,6 +44,8 @@ public class UserEmpowerInterceptor implements Interceptor {
if
(
userEmpower
==
null
){
if
(
userEmpower
==
null
){
return
invocation
.
proceed
();
return
invocation
.
proceed
();
}
}
StdUserEmpower
orgCode
=
UserEmpowerThreadLocal
.
getDataAuthRule
();
if
(
orgCode
!=
null
&&
orgCode
.
isFlag
()){
//获取字段
//获取字段
String
[]
filed
=
userEmpower
.
field
();
String
[]
filed
=
userEmpower
.
field
();
//获取字段条件表达式
//获取字段条件表达式
...
@@ -97,7 +100,9 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -97,7 +100,9 @@ public class UserEmpowerInterceptor implements Interceptor {
}
}
System
.
out
.
println
(
selectBody
.
toString
());
System
.
out
.
println
(
selectBody
.
toString
());
metaObject
.
setValue
(
"delegate.boundSql.sql"
,
selectBody
.
toString
());
metaObject
.
setValue
(
"delegate.boundSql.sql"
,
selectBody
.
toString
());
}
else
{
return
invocation
.
proceed
();
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
BadRequest
(
"权限认证失败!"
);
throw
new
BadRequest
(
"权限认证失败!"
);
...
@@ -105,9 +110,7 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -105,9 +110,7 @@ public class UserEmpowerInterceptor implements Interceptor {
UserEmpowerThreadLocal
.
clean
();
UserEmpowerThreadLocal
.
clean
();
}
}
return
invocation
.
proceed
();
return
invocation
.
proceed
();
}
else
{
return
invocation
.
proceed
();
}
}
}
@Override
@Override
...
@@ -130,11 +133,12 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -130,11 +133,12 @@ public class UserEmpowerInterceptor implements Interceptor {
if
(
specific
){
if
(
specific
){
List
<
String
>
data
=
stdUserEmpower
.
getAmosOrgCode
();
List
<
String
>
data
=
stdUserEmpower
.
getAmosOrgCode
();
List
<
String
>
notdata
=
stdUserEmpower
.
getEliminateAmosOrgCode
();
List
<
String
>
notdata
=
stdUserEmpower
.
getEliminateAmosOrgCode
();
List
<
String
>
wnotdata
=
stdUserEmpower
.
getNOeliminateAmosOrgCode
();
if
(
filed
!=
null
&&
filed
.
length
>
0
){
if
(
filed
!=
null
&&
filed
.
length
>
0
){
for
(
int
i
=
0
;
i
<
filed
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
filed
.
length
;
i
++)
{
String
sq
=
" "
;
String
sq
=
" "
;
sq
=
getConditiontd
(
filed
[
i
],
fileCondition
[
i
],
data
,
notdata
);
sq
=
getConditiontd
(
filed
[
i
],
fileCondition
[
i
],
data
,
notdata
,
wnotdata
);
sql
.
add
(
sq
);
sql
.
add
(
sq
);
}
}
}
}
...
@@ -156,13 +160,55 @@ public class UserEmpowerInterceptor implements Interceptor {
...
@@ -156,13 +160,55 @@ public class UserEmpowerInterceptor implements Interceptor {
}
}
//特定管理端条件
//特定管理端条件
private
String
getConditiontd
(
String
filed
,
String
type
,
List
<
String
>
data
,
List
<
String
>
notdata
){
private
String
getConditiontd
(
String
filed
,
String
type
,
List
<
String
>
data
,
List
<
String
>
wdata
,
List
<
String
>
w
notdata
){
String
sql
=
" "
;
String
sql
=
" "
;
if
(
data
!=
null
&&!
data
.
isEmpty
()){
if
(
data
.
contains
(
"all"
)){
if
(
data
==
null
||
data
.
size
()==
0
){
sql
=
sql
+
getnotInData
(
filed
,
notdata
);
}
else
{
//内部不选 外部不选
sql
=
sql
+
getInData
(
filed
,
data
)
+
"and"
+
getnotInData
(
filed
,
notdata
);
if
(
wdata
==
null
||
wdata
.
size
()==
0
){
//返回空不处理
sql
=
" "
;
}
//内部不选 外部全部
//内部不选 外部选一部分
if
(
wdata
!=
null
&&
wdata
.
size
()>
0
){
sql
=
sql
+
getInData
(
filed
,
wdata
);
}
}
else
if
(
data
.
contains
(
"all"
)){
//内部全选, 外部不选
if
(
wdata
==
null
||
wdata
.
size
()==
0
){
sql
=
sql
+
getnotInData
(
filed
,
wnotdata
);
}
//内部全选, 外度全选
if
(
wdata
!=
null
&&
wdata
.
size
()!=
0
&&
wnotdata
==
null
){
//返回恒等看所有
sql
=
sql
+
" 1=1 "
;
}
//内部全选, 外部选一部分
if
(
wdata
!=
null
&&
wdata
.
size
()!=
0
&&
wnotdata
!=
null
){
//返回恒等看所有
sql
=
sql
+
getnotInData
(
filed
,
wnotdata
);
}
}
else
{
//内部选一部分, 外度全选
if
(
wdata
!=
null
&&
wdata
.
size
()!=
0
&&
wnotdata
==
null
){
sql
=
sql
+
getInData
(
filed
,
data
);
}
//内部选一部分 外部选一部分
if
(
wdata
!=
null
&&
wdata
.
size
()!=
0
&&
wnotdata
!=
null
){
data
.
addAll
(
wdata
);
sql
=
sql
+
getInData
(
filed
,
data
);
}
//内部选一部分 外部不选
if
(
wdata
==
null
||
wdata
.
size
()==
0
){
sql
=
sql
+
getInData
(
filed
,
data
);
}
}
}
}
return
sql
;
return
sql
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/UserLimitsAdvice.java
View file @
f564cc3c
...
@@ -23,6 +23,9 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
...
@@ -23,6 +23,9 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @description:
* @description:
...
@@ -37,8 +40,8 @@ public class UserLimitsAdvice {
...
@@ -37,8 +40,8 @@ public class UserLimitsAdvice {
@Autowired
@Autowired
private
UserEmpowerMapper
userEmpowerMapper
;
private
UserEmpowerMapper
userEmpowerMapper
;
@Autowired
//
@Autowired
PersonnelBusinessMapper
personnelBusinessMapper
;
////
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
...
@@ -60,10 +63,11 @@ public class UserLimitsAdvice {
...
@@ -60,10 +63,11 @@ public class UserLimitsAdvice {
//判断是否经销商,经销商跟管理端互斥
//判断是否经销商,经销商跟管理端互斥
String
org
=
reginParams
.
getUserModel
().
getOrgNames
();
String
org
=
reginParams
.
getUserModel
().
getOrgNames
();
if
(
org
.
contains
(
ROLEFLAG
)){
if
(
org
.
contains
(
ROLEFLAG
)){
UserUnitInformationDto
userUnitInformationDto
=
personnelBusinessMapper
.
getUserUnitInformationDto
(
userid
);
// UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto(userid);
UserUnitInformationDto
userUnitInformationDto
=
null
;
stdUserEmpower
.
setFlag
(
false
);
stdUserEmpower
.
setFlag
(
false
);
stdUserEmpower
.
setDeveloperId
(
userUnitInformationDto
.
getAmosUnitInfoId
()
);
stdUserEmpower
.
setDeveloperId
(
userUnitInformationDto
!=
null
?
userUnitInformationDto
.
getAmosUnitInfoId
():
null
);
stdUserEmpower
.
setRegionalCompaniesCode
(
userUnitInformationDto
.
getRegionalCompaniesCode
()
);
stdUserEmpower
.
setRegionalCompaniesCode
(
userUnitInformationDto
!=
null
?
userUnitInformationDto
.
getRegionalCompaniesCode
():
null
);
stdUserEmpower
.
setUserId
(
userid
);
stdUserEmpower
.
setUserId
(
userid
);
}
else
{
}
else
{
LambdaQueryWrapper
<
StdUserEmpower
>
qu
=
new
LambdaQueryWrapper
();
LambdaQueryWrapper
<
StdUserEmpower
>
qu
=
new
LambdaQueryWrapper
();
...
@@ -71,6 +75,9 @@ public class UserLimitsAdvice {
...
@@ -71,6 +75,9 @@ public class UserLimitsAdvice {
qu
.
eq
(
StdUserEmpower:
:
getPermissionType
,
"HYGF"
);
qu
.
eq
(
StdUserEmpower:
:
getPermissionType
,
"HYGF"
);
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
qu
);
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
qu
);
stdUserEmpower
.
setFlag
(
true
);
stdUserEmpower
.
setFlag
(
true
);
//获取外部不选数据
List
<
Map
<
String
,
String
>>
lis
=
userEmpowerMapper
.
georgcodelist
(
stdUserEmpower
.
getEliminateAmosOrgCode
());
stdUserEmpower
.
setNOeliminateAmosOrgCode
(
lis
!=
null
?
lis
.
stream
().
map
(
t
->
t
.
get
(
"orgCode"
).
toString
()).
collect
(
Collectors
.
toList
()):
null
);
}
}
UserEmpowerThreadLocal
.
setDataAuthRule
(
stdUserEmpower
!=
null
?
stdUserEmpower:
null
);
UserEmpowerThreadLocal
.
setDataAuthRule
(
stdUserEmpower
!=
null
?
stdUserEmpower:
null
);
//正常往后执行
//正常往后执行
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/UserUnitInformationDto.java
View file @
f564cc3c
...
@@ -39,8 +39,7 @@ public class UserUnitInformationDto {
...
@@ -39,8 +39,7 @@ public class UserUnitInformationDto {
@ApiModelProperty
(
value
=
"经销商单位id"
)
@ApiModelProperty
(
value
=
"经销商单位id"
)
private
Long
amosUnitInfoId
;
private
Long
amosUnitInfoId
;
@ApiModelProperty
(
value
=
"role"
)
private
String
role
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/StdUserEmpower.java
View file @
f564cc3c
...
@@ -39,12 +39,20 @@ public class StdUserEmpower extends BaseEntity {
...
@@ -39,12 +39,20 @@ public class StdUserEmpower extends BaseEntity {
private
String
permissionType
;
private
String
permissionType
;
/**
/**
* 单位orgcode
*
外部选中
单位orgcode
*/
*/
@TableField
(
value
=
"eliminate_amos_org_code"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
@TableField
(
value
=
"eliminate_amos_org_code"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
eliminateAmosOrgCode
;
private
List
<
String
>
eliminateAmosOrgCode
;
/**
* 外部 不选中单位orgcode
*/
@TableField
(
exist
=
false
)
private
List
<
String
>
NOeliminateAmosOrgCode
;
//登录人id
//登录人id
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
userId
;
private
String
userId
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/UserEmpowerMapper.java
View file @
f564cc3c
...
@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.api.mapper;
...
@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @description:
* @description:
...
@@ -10,4 +14,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
...
@@ -10,4 +14,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.StdUserEmpower;
*/
*/
public
interface
UserEmpowerMapper
extends
BaseMapper
<
StdUserEmpower
>
{
public
interface
UserEmpowerMapper
extends
BaseMapper
<
StdUserEmpower
>
{
List
<
Map
<
String
,
String
>>
georgcodelist
(
@Param
(
"orgs"
)
List
<
String
>
orgs
);
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/PersonnelBusinessMapper.xml
View file @
f564cc3c
...
@@ -68,7 +68,6 @@ select ORG_CODE orgCode from privilege_company where privilege_company.SEQUEN
...
@@ -68,7 +68,6 @@ select ORG_CODE orgCode from privilege_company where privilege_company.SEQUEN
hygf_personnel_business.amos_dealer_id amosDealerId ,
hygf_personnel_business.amos_dealer_id amosDealerId ,
privilege_company.COMPANY_NAME amosDealerName ,
privilege_company.COMPANY_NAME amosDealerName ,
privilege_company.ORG_CODE amosDealerOrgCode,
privilege_company.ORG_CODE amosDealerOrgCode,
std_user_biz.role role,
(select sequence_nbr from hygf_unit_info h where h.amos_company_seq= hygf_personnel_business.amos_dealer_id )amosUnitInfoId
(select sequence_nbr from hygf_unit_info h where h.amos_company_seq= hygf_personnel_business.amos_dealer_id )amosUnitInfoId
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/UserEmpowerMapper.xml
0 → 100644
View file @
f564cc3c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.hygf.api.mapper.UserEmpowerMapper"
>
<select
id=
"georgcodelist"
resultType=
"Map"
>
select ORG_CODE orgCode from privilege_company where COMPANY_TYPE='region' and LEVEL='outer_company'
<if
test=
"orgs != null and orgs.size() >0"
>
and ORG_CODE not in
<foreach
collection=
"orgs"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PowerStationController.java
View file @
f564cc3c
...
@@ -96,9 +96,9 @@ public class PowerStationController extends BaseController {
...
@@ -96,9 +96,9 @@ public class PowerStationController extends BaseController {
@GetMapping
(
value
=
"/page"
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<
PowerStationDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
public
ResponseModel
<
Page
<
PowerStationDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"powerStationCode"
,
required
=
false
)
String
powerStationCode
,
@RequestParam
(
value
=
"powerStationCode"
,
required
=
false
)
String
powerStationCode
,
@RequestParam
(
value
=
"ownersName"
,
required
=
false
)
String
ownersName
)
{
@RequestParam
(
value
=
"ownersName"
,
required
=
false
)
String
ownersName
)
{
Page
<
PowerStationDto
>
page
=
new
Page
<
PowerStationDto
>();
Page
<
PowerStationDto
>
page
=
new
Page
<
PowerStationDto
>();
page
.
setCurrent
(
current
);
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
page
.
setSize
(
size
);
...
...
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