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
b020e6c6
Commit
b020e6c6
authored
Oct 14, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tcm): 更新人员管理列表查询
parent
d90b7d12
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
9 deletions
+120
-9
UserPermissionDto.java
...in/amos/boot/module/common/api/dto/UserPermissionDto.java
+6
-0
TzBaseEnterpriseInfoMapper.xml
.../src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
+4
-4
TzsUserInfoMapper.xml
...e-tcm-api/src/main/resources/mapper/TzsUserInfoMapper.xml
+2
-2
TzsUserInfoServiceImpl.java
...t/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
+22
-3
EnhancedDynamicQueryBuilder.java
...oot/module/tcm/biz/utils/EnhancedDynamicQueryBuilder.java
+86
-0
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/UserPermissionDto.java
View file @
b020e6c6
...
...
@@ -107,6 +107,12 @@ public class UserPermissionDto {
private
String
superviseOrgCode
;
/**
* 管辖机构CompanyCode
*/
@JsonIgnore
private
String
superviseCompanyCode
;
/**
* 使用单位统一信用代码
*/
private
String
useCode
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
View file @
b020e6c6
...
...
@@ -112,8 +112,8 @@
or tzBaseEnterpriseInfoDto.unitType == '检测机构'
or tzBaseEnterpriseInfoDto.unitType == ''
or tzBaseEnterpriseInfoDto.unitType == null ) and tzBaseEnterpriseInfoDto.orgCode!= '' "
>
and ((
b.supervise_org_code != '50' and b.
supervise_org_code LIKE CONCAT (#{orgCode}, '%'))
or (
b.supervise_org_code = '50' and b.
office_region LIKE CONCAT ('%', #{regionCode}, '%')))
and ((
supervise_org_code != '50' and
supervise_org_code LIKE CONCAT (#{orgCode}, '%'))
or (
supervise_org_code = '50' and
office_region LIKE CONCAT ('%', #{regionCode}, '%')))
</when>
<otherwise>
and supervise_org_code LIKE CONCAT(#{orgCode}, '%')
...
...
@@ -156,8 +156,8 @@
or tzBaseEnterpriseInfoDto.unitType == '检测机构'
or tzBaseEnterpriseInfoDto.unitType == ''
or tzBaseEnterpriseInfoDto.unitType == null"
>
and ((
b.supervise_org_code != '50' and b.
supervise_org_code LIKE CONCAT (#{tzBaseEnterpriseInfoDto.superviseOrgCode}, '%'))
or (
b.supervise_org_code = '50' and b.
office_region LIKE CONCAT ('%', #{tzBaseEnterpriseInfoDto.OfficeRegionStr}, '%')))
and ((
supervise_org_code != '50' and
supervise_org_code LIKE CONCAT (#{tzBaseEnterpriseInfoDto.superviseOrgCode}, '%'))
or (
supervise_org_code = '50' and
office_region LIKE CONCAT ('%', #{tzBaseEnterpriseInfoDto.OfficeRegionStr}, '%')))
</when>
<otherwise>
and supervise_org_code LIKE CONCAT(#{orgCode}, '%')
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzsUserInfoMapper.xml
View file @
b020e6c6
...
...
@@ -343,7 +343,6 @@
<foreach
collection=
"postList"
item=
"item"
separator=
","
>
#{item}
</foreach>
]
</if>
<if
test=
"filter.postCode != null and filter.postCode != ''"
>
and u.new_post like concat('%',#{filter.postCode}, '%')
...
...
@@ -352,7 +351,8 @@
and u.sub_post like concat('%',#{filter.subPostCode}, '%')
</if>
<if
test=
"filter.superviseOrgCode != null and filter.superviseOrgCode != ''"
>
and e.supervise_org_code like concat('%',#{filter.superviseOrgCode}, '%')
and ((e.supervise_org_code != '50' and e.supervise_org_code LIKE CONCAT (#{filter.superviseOrgCode}, '%'))
or (e.supervise_org_code = '50' and e.office_region LIKE CONCAT ('%', #{regionCode}, '%')))
</if>
<if
test=
"filter.createDateStart != null and filter.createDateEnd != null"
>
and (u.create_date between #{filter.createDateStart} and #{filter.createDateEnd})
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
View file @
b020e6c6
...
...
@@ -54,6 +54,7 @@ import com.yeejoin.amos.boot.module.tcm.api.vo.SortVo;
import
com.yeejoin.amos.boot.module.tcm.api.vo.TzsUserInfoVo
;
import
com.yeejoin.amos.boot.module.tcm.api.vo.UserInfoVo
;
import
com.yeejoin.amos.boot.module.tcm.biz.refresh.handler.UserRefreshHandler
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.EnhancedDynamicQueryBuilder
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
...
...
@@ -1089,6 +1090,12 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Page
<
UserPermissionDto
>
permissionDtoPage
=
new
Page
<>(
current
,
size
);
List
<
String
>
post
=
this
.
getPostByType
(
type
);
SortVo
sortMap
=
this
.
sortFieldConversion
(
sort
);
if
(!
ObjectUtils
.
isEmpty
(
filter
.
getSuperviseOrgCode
()))
{
FeignClientResult
<
CompanyModel
>
result
=
Privilege
.
companyClient
.
queryByOrgcode
(
filter
.
getSuperviseOrgCode
());
if
(
result
.
getStatus
()
==
200
){
filter
.
setSuperviseCompanyCode
(
result
.
getResult
().
getCompanyCode
());
}
}
Page
<
UserPermissionDto
>
result
=
this
.
getBaseMapper
().
queryUserByPermissionPage
(
permissionDtoPage
,
post
,
filter
,
sortMap
);
result
.
getRecords
().
forEach
(
d
->
{
if
(
StringUtils
.
isNotEmpty
(
d
.
getIdentificationStr
()))
{
...
...
@@ -2835,9 +2842,21 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
// 属地监管部门
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"superviseOrgCode"
)))
{
String
superviseOrgCode
=
map
.
get
(
"superviseOrgCode"
);
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
prefixQuery
(
"superviseOrgCode"
,
superviseOrgCode
));
boolMust
.
must
(
meBuilder
);
FeignClientResult
<
CompanyModel
>
feignClientResult
=
Privilege
.
companyClient
.
queryByOrgcode
(
superviseOrgCode
);
String
companyCode
=
null
;
if
(
ObjectUtils
.
isEmpty
(
feignClientResult
)
&&
feignClientResult
.
getStatus
()
==
200
)
{
companyCode
=
feignClientResult
.
getResult
().
getCompanyCode
();
}
BoolQueryBuilder
queryBuilder1
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
queryBuilder2
=
QueryBuilders
.
boolQuery
();
EnhancedDynamicQueryBuilder
enhancedDynamicQueryBuilder
=
new
EnhancedDynamicQueryBuilder
();
queryBuilder1
.
must
(
QueryBuilders
.
termQuery
(
"superviseOrgCode"
,
"50"
))
.
must
(
QueryBuilders
.
wildcardQuery
(
"officeRegion"
,
"*"
+
companyCode
+
"*"
));
queryBuilder2
.
mustNot
(
QueryBuilders
.
termQuery
(
"superviseOrgCode"
,
"50"
))
.
must
(
QueryBuilders
.
prefixQuery
(
"superviseOrgCode"
,
superviseOrgCode
));
enhancedDynamicQueryBuilder
.
add
(
queryBuilder1
,
"or"
);
enhancedDynamicQueryBuilder
.
add
(
queryBuilder2
,
"or"
);
boolMust
.
must
(
enhancedDynamicQueryBuilder
.
build
());
}
// 资质状态
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/utils/EnhancedDynamicQueryBuilder.java
0 → 100644
View file @
b020e6c6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
utils
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
EnhancedDynamicQueryBuilder
{
private
final
List
<
QueryBuilder
>
initialClauses
=
new
ArrayList
<>();
private
String
groupLogic
;
// "AND" 或 "OR"
private
final
List
<
QueryBuilder
>
mustClauses
=
new
ArrayList
<>();
private
final
List
<
QueryBuilder
>
shouldClauses
=
new
ArrayList
<>();
private
final
List
<
QueryBuilder
>
mustNotClauses
=
new
ArrayList
<>();
public
EnhancedDynamicQueryBuilder
()
{
this
(
"AND"
);
// 默认组间关系为AND
}
public
EnhancedDynamicQueryBuilder
(
String
groupLogic
)
{
this
.
groupLogic
=
groupLogic
!=
null
?
groupLogic
:
"AND"
;
}
/**
* 添加条件,自动处理第一个条件为null的情况
* @param query 查询条件
* @param logic 逻辑关系 (AND/OR/NOT),第一个条件可为null
*/
public
EnhancedDynamicQueryBuilder
add
(
QueryBuilder
query
,
String
logic
)
{
if
(
logic
==
null
)
{
if
(
isEmpty
())
{
// 第一个条件,默认作为must条件
mustClauses
.
add
(
query
);
}
else
{
// 后续条件未指定逻辑,使用组间默认逻辑
if
(
"OR"
.
equalsIgnoreCase
(
groupLogic
))
{
shouldClauses
.
add
(
query
);
}
else
{
mustClauses
.
add
(
query
);
}
}
}
else
{
switch
(
logic
.
toUpperCase
())
{
case
"AND"
:
mustClauses
.
add
(
query
);
break
;
case
"OR"
:
shouldClauses
.
add
(
query
);
break
;
case
"NOT"
:
mustNotClauses
.
add
(
query
);
break
;
default
:
throw
new
IllegalArgumentException
(
"Unsupported logic: "
+
logic
);
}
}
return
this
;
}
public
BoolQueryBuilder
build
()
{
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
// 处理must条件
mustClauses
.
forEach
(
boolQuery:
:
must
);
// 处理should条件
if
(!
shouldClauses
.
isEmpty
())
{
shouldClauses
.
forEach
(
boolQuery:
:
should
);
// 如果没有must条件,至少满足一个should
if
(
mustClauses
.
isEmpty
())
{
boolQuery
.
minimumShouldMatch
(
1
);
}
}
// 处理mustNot条件
mustNotClauses
.
forEach
(
boolQuery:
:
mustNot
);
return
boolQuery
;
}
private
boolean
isEmpty
()
{
return
mustClauses
.
isEmpty
()
&&
shouldClauses
.
isEmpty
()
&&
mustNotClauses
.
isEmpty
();
}
}
\ No newline at end of file
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