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
07a487b8
Commit
07a487b8
authored
Aug 11, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(module-jg): 优化特种设备使用登记列表查询性能
- 新增 getListPage1 和 getListPageCount 方法,用于分页查询和统计总数 - 优化查询条件,使用索引提高查询效率- 添加日志记录,监控查询性能
parent
62e2ffcf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
312 additions
and
1 deletion
+312
-1
JgUseRegistrationMapper.java
...os/boot/module/jg/api/mapper/JgUseRegistrationMapper.java
+13
-0
JgUseRegistrationMapper.xml
...api/src/main/resources/mapper/JgUseRegistrationMapper.xml
+287
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+12
-1
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgUseRegistrationMapper.java
View file @
07a487b8
...
...
@@ -29,6 +29,19 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
@Param
(
"roleIds"
)
List
<
String
>
roleIds
,
@Param
(
"client"
)
String
client
);
List
<
Map
<
String
,
Object
>>
getListPage1
(
@Param
(
"size"
)
Long
size
,
@Param
(
"offset"
)
Long
offset
,
@Param
(
"sort"
)
SortVo
sortMap
,
@Param
(
"dto"
)
JgUseRegistrationDto
dto
,
@Param
(
"roleIds"
)
List
<
String
>
roleIds
,
@Param
(
"client"
)
String
client
);
Long
getListPageCount
(
@Param
(
"sort"
)
SortVo
sortMap
,
@Param
(
"dto"
)
JgUseRegistrationDto
dto
,
@Param
(
"roleIds"
)
List
<
String
>
roleIds
,
@Param
(
"client"
)
String
client
);
List
<
RegistrationVo
>
queryRegistrationInIds
(
@Param
(
"dto"
)
JgUseRegistrationDto
dto
,
@Param
(
"client"
)
String
client
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgUseRegistrationMapper.xml
View file @
07a487b8
...
...
@@ -379,6 +379,293 @@
</choose>
</select>
<select
id=
"getListPage1"
resultType=
"java.util.Map"
>
WITH filtered_ur AS (
SELECT
sequence_nbr,
audit_status,
reg_date,
use_unit_name,
supervision_org_code,
status,
receive_org_name,
use_address,
instance_id,
apply_no,
next_execute_ids,
promoter,
use_registration_code,
audit_pass_date,
create_date,
next_execute_user_ids,
next_task_id,
create_user_id,
rec_date,
manage_type,
reg_type,
is_delete,
receive_company_code,
use_unit_credit_code,
transfer_to_user_ids,
cancel_reason,
project_contraption_id
FROM tzs_jg_use_registration
WHERE is_delete = 0
AND supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
AND status
<![CDATA[<>]]>
'使用单位待提交'
<!-- 公共主表过滤条件 -->
<if
test=
"dto.status != null and dto.status != ''"
>
AND status = #{dto.status}
</if>
<if
test=
"dto.applicationDate != null"
>
AND create_date LIKE CONCAT('%', DATE_FORMAT(#{dto.applicationDate}, '%Y-%m-%d'), '%')
</if>
<if
test=
"dto.fullAddress != null and dto.fullAddress != ''"
>
AND use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if
test=
"dto.useUnitName != null and dto.useUnitName != ''"
>
AND use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if
test=
"dto.applyNo != null and dto.applyNo != ''"
>
AND apply_no LIKE CONCAT('%', #{dto.applyNo}, '%')
</if>
<if
test=
"dto.useRegistrationCode != null and dto.useRegistrationCode != ''"
>
AND use_registration_code LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if>
<if
test=
"dto.useUnitCode != null and dto.useUnitCode != ''"
>
AND use_unit_credit_code = #{dto.useUnitCode}
</if>
<if
test=
"dto.orgBranchCode != null and dto.orgBranchCode != ''"
>
<choose>
<when
test=
"client == 'jgLook'"
>
AND supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</when>
<otherwise>
AND supervision_org_code = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if
test=
"dto.auditPassDateStart != null and dto.auditPassDateEnd != null"
>
AND audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if
test=
"dto.dataType == 'supervision' "
>
<choose>
<when
test=
"client == 'jgAudit'"
>
AND (receive_company_code = #{dto.receiveCompanyCode}
OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
</if>
<if
test=
"dto.dataType == 'company' "
>
AND (use_unit_credit_code = #{dto.unitCode}
OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
ORDER BY
<choose>
<when
test=
"sort != null"
>
${sort.field} ${sort.sortType}
</when>
<otherwise>
create_date DESC, apply_no DESC
</otherwise>
</choose>
LIMIT #{size} OFFSET #{offset}
),
equipment_data AS (
SELECT
re.equip_transfer_id,
GROUP_CONCAT(re.equ_id) AS equipId,
GROUP_CONCAT(DISTINCT other.supervisory_code) AS supervisoryCode,
GROUP_CONCAT(DISTINCT other.CODE96333) AS code96333,
GROUP_CONCAT(jri.PRODUCT_NAME) AS productName,
GROUP_CONCAT(DISTINCT jri.EQU_CODE) AS equCode,
GROUP_CONCAT(DISTINCT jri.EQU_LIST) AS equListCode,
GROUP_CONCAT(DISTINCT jri.EQU_CATEGORY) AS equCategoryCode,
GROUP_CONCAT(DISTINCT jri.EQU_DEFINE) AS equDefineCode,
GROUP_CONCAT(DISTINCT c_list.name) AS equListName,
GROUP_CONCAT(DISTINCT c_cate.name) AS equCategory,
GROUP_CONCAT(DISTINCT c_def.name) AS equDefine
FROM filtered_ur fu
JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_other_info other ON jri.RECORD = other.RECORD
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code
<where>
<!-- 统一设备过滤条件 -->
<if
test=
"dto.equList != null and dto.equList != ''"
>
AND jri.EQU_LIST = #{dto.equList}
</if>
<if
test=
"dto.equCategory != null and dto.equCategory != ''"
>
AND jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if
test=
"dto.equDefine != null and dto.equDefine != ''"
>
AND jri.EQU_DEFINE = #{dto.equDefine}
</if>
</where>
GROUP BY re.equip_transfer_id
)
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
fu.receive_org_name AS receiveOrgName,
fu.use_address AS place,
fu.instance_id AS instanceId,
fu.apply_no AS applyNo,
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate,
fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
fu.rec_date AS recDate,
fu.manage_type AS manageType,
fu.reg_type AS regType,
fu.is_delete,
fu.create_date,
fu.receive_company_code,
fu.use_unit_credit_code,
fu.transfer_to_user_ids,
fu.supervision_org_code,
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
<!-- 设备字段 -->
COALESCE(ed.equipId, '') AS equipId,
COALESCE(ed.supervisoryCode, '') AS supervisoryCode,
COALESCE(ed.code96333, '') AS code96333,
COALESCE(ed.productName, '') AS productName,
COALESCE(ed.equCode, '') AS equCode,
COALESCE(ed.equListCode, '') AS equListCode,
COALESCE(ed.equCategoryCode, '') AS equCategoryCode,
COALESCE(ed.equDefineCode, '') AS equDefineCode,
COALESCE(ed.equListName, '') AS equListName,
COALESCE(ed.equCategory, '') AS equCategory,
COALESCE(ed.equDefine, '') AS equDefine
FROM filtered_ur fu
LEFT JOIN equipment_data ed ON fu.sequence_nbr = ed.equip_transfer_id
WHERE 1=1
<!-- 设备代码过滤 -->
<if
test=
"dto.equCode != null and dto.equCode != ''"
>
AND ed.equCode LIKE CONCAT('%', #{dto.equCode}, '%')
</if>
<!-- 96333码过滤 -->
<if
test=
"dto.code96333 != null and dto.code96333 != ''"
>
AND ed.code96333 LIKE CONCAT('%', #{dto.code96333}, '%')
</if>
<!-- 监管码过滤 -->
<if
test=
"dto.supervisoryCode != null and dto.supervisoryCode != ''"
>
AND ed.supervisoryCode LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
ORDER BY
<choose>
<when
test=
"sort != null"
>
${sort.field} ${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
</select>
<select
id=
"getListPageCount"
resultType=
"java.lang.Long"
>
SELECT
<![CDATA[/*+ set(query_dop 16)*/]]>
COUNT(DISTINCT ur.sequence_nbr)
FROM tzs_jg_use_registration ur
LEFT JOIN tzs_jg_use_registration_eq re ON ur.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri.RECORD
WHERE ur.is_delete = 0
AND ur.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
AND ur.status
<![CDATA[<>]]>
'使用单位待提交'
<!-- 统一设备过滤条件 -->
<if
test=
"dto.equList != null and dto.equList != ''"
>
AND jri.EQU_LIST = #{dto.equList}
</if>
<if
test=
"dto.equCategory != null and dto.equCategory != ''"
>
AND jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if
test=
"dto.equDefine != null and dto.equDefine != ''"
>
AND jri.EQU_DEFINE = #{dto.equDefine}
</if>
<!-- 设备代码过滤 -->
<if
test=
"dto.equCode != null and dto.equCode != ''"
>
AND equCode LIKE CONCAT('%', #{dto.equCode}, '%')
</if>
<!-- 96333码过滤 -->
<if
test=
"dto.code96333 != null and dto.code96333 != ''"
>
AND code96333 LIKE CONCAT('%', #{dto.code96333}, '%')
</if>
<!-- 监管码过滤 -->
<if
test=
"dto.supervisoryCode != null and dto.supervisoryCode != ''"
>
AND supervisoryCode LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
<if
test=
"dto.status != null and dto.status != ''"
>
AND status = #{dto.status}
</if>
<if
test=
"dto.applicationDate != null"
>
AND create_date LIKE CONCAT('%', DATE_FORMAT(#{dto.applicationDate}, '%Y-%m-%d'), '%')
</if>
<if
test=
"dto.fullAddress != null and dto.fullAddress != ''"
>
AND use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if
test=
"dto.useUnitName != null and dto.useUnitName != ''"
>
AND use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if
test=
"dto.applyNo != null and dto.applyNo != ''"
>
AND apply_no LIKE CONCAT('%', #{dto.applyNo}, '%')
</if>
<if
test=
"dto.useRegistrationCode != null and dto.useRegistrationCode != ''"
>
AND use_registration_code LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if>
<if
test=
"dto.useUnitCode != null and dto.useUnitCode != ''"
>
AND use_unit_credit_code = #{dto.useUnitCode}
</if>
<if
test=
"dto.orgBranchCode != null and dto.orgBranchCode != ''"
>
<choose>
<when
test=
"client == 'jgLook'"
>
AND supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</when>
<otherwise>
AND supervision_org_code = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if
test=
"dto.auditPassDateStart != null and dto.auditPassDateEnd != null"
>
AND audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if
test=
"dto.dataType == 'supervision' "
>
<choose>
<when
test=
"client == 'jgAudit'"
>
AND (receive_company_code = #{dto.receiveCompanyCode}
OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
</if>
<if
test=
"dto.dataType == 'company' "
>
AND (use_unit_credit_code = #{dto.unitCode}
OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
</select>
<select
id=
"queryRegistrationInIds"
resultType=
"com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.RegistrationVo"
>
select
*
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
View file @
07a487b8
...
...
@@ -78,6 +78,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.compress.utils.Lists
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -139,6 +141,8 @@ import static java.util.stream.Collectors.toSet;
@Getter
public
class
JgUseRegistrationServiceImpl
extends
BaseService
<
JgUseRegistrationDto
,
JgUseRegistration
,
JgUseRegistrationMapper
>
implements
IJgUseRegistrationService
,
ICompensateFlowDataOfRedis
<
JgUseRegistration
>,
ApplicationContextAware
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
JgUseRegistrationServiceImpl
.
class
);
private
static
final
String
DEFINITION_KEY
=
"useRegistration"
;
private
static
final
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);;
private
final
List
<
String
>
NOT_FLOWING_STATE
=
Arrays
.
asList
(
"使用单位待提交"
,
"一级受理已驳回"
,
"使用单位已撤回"
,
"已作废"
);
...
...
@@ -349,7 +353,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public
Page
<
Map
<
String
,
Object
>>
getList
(
JgUseRegistrationDto
dto
,
String
sort
,
Page
<
Map
<
String
,
Object
>>
page
,
List
<
String
>
roleIds
,
String
client
)
{
SortVo
sortMap
=
commonServiceImpl
.
sortFieldConversionNoToUnderline
(
sort
);
return
this
.
baseMapper
.
getListPage
(
page
,
sortMap
,
dto
,
roleIds
,
client
);
// 统计查询时间
long
startTime
=
System
.
currentTimeMillis
();
List
<
Map
<
String
,
Object
>>
resultRecords
=
this
.
baseMapper
.
getListPage1
(
page
.
getSize
(),
page
.
getSize
()
*
(
page
.
getCurrent
()
-
1
),
sortMap
,
dto
,
roleIds
,
client
);
page
.
setRecords
(
resultRecords
);
logger
.
info
(
"开始执行查询列表总数"
);
page
.
setTotal
(
this
.
baseMapper
.
getListPageCount
(
sortMap
,
dto
,
roleIds
,
client
));
logger
.
info
(
"结束执行查询列表总数,耗时:{}毫秒"
,
(
System
.
currentTimeMillis
()
-
startTime
));
return
page
;
}
public
Page
<
Map
<
String
,
Object
>>
getEquipList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
factoryNum
,
String
equList
,
String
equCategory
)
{
...
...
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