Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
zlmy-cloud
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
zlmy
zlmy-cloud
Commits
b35436bc
Commit
b35436bc
authored
Dec 09, 2025
by
鲁鸿波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页危险作业统计数据从系统中统计
parent
6bc9d714
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
198 additions
and
1 deletion
+198
-1
THazardWorkPlanDao.java
...java/com/testor/module/hazard/dao/THazardWorkPlanDao.java
+27
-0
THazardWorkPlanService.java
.../testor/module/hazard/service/THazardWorkPlanService.java
+12
-0
THazardWorkPlanServiceImpl.java
...odule/hazard/service/impl/THazardWorkPlanServiceImpl.java
+10
-0
TJobStatisticsParam.java
.../testor/module/partner/model/dto/TJobStatisticsParam.java
+3
-0
TJobStatisticsServiceImpl.java
...odule/partner/service/impl/TJobStatisticsServiceImpl.java
+69
-1
THazardWorkPlan.xml
...boot/src/main/resources/mapper/hazard/THazardWorkPlan.xml
+77
-0
No files found.
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/dao/THazardWorkPlanDao.java
View file @
b35436bc
...
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.testor.module.hazard.model.domain.THazardWorkPlan
;
import
com.testor.module.hazard.model.dto.THazardWorkPlanParam
;
import
com.testor.module.hazard.model.dto.THazardWorkPlanRiverside
;
import
com.testor.module.partner.model.dto.TJobStatisticsParam
;
import
com.testor.module.partner.model.vo.RegionalStatisticsVO
;
import
com.tongtech.tfw.backend.common.models.supers.SuperDao
;
import
com.tongtech.tfw.workflow.apis.task.model.dto.TodoTask
;
import
com.tongtech.tfw.workflow.apis.task.model.dto.TodoTaskSqlParam
;
...
...
@@ -46,4 +48,29 @@ public interface THazardWorkPlanDao extends SuperDao<THazardWorkPlan>
*/
Page
<
THazardWorkPlanRiverside
>
riversideList
(
Page
<
THazardWorkPlan
>
page
,
@Param
(
"param"
)
THazardWorkPlanParam
param
);
/**
* 查询已完成的危险作业数量
* @return
*/
Integer
completedCount
(
@Param
(
"orgIds"
)
List
<
String
>
orgIds
);
/**
* 查询未完成的危险作业数量
* @return
*/
Integer
unfinishedCount
(
@Param
(
"orgIds"
)
List
<
String
>
orgIds
);
/**
* 获取危险作业数量
* @return
*/
List
<
RegionalStatisticsVO
>
selectOrgWorkPlanCount
(
@Param
(
"tJobStatisticsParam"
)
TJobStatisticsParam
tJobStatisticsParam
);
/**
* 获取某组织当天的危险作业数(按作业类型分类)
* @param tJobStatisticsParam
* @return
*/
List
<
RegionalStatisticsVO
>
selectWorkTypeCount
(
@Param
(
"tJobStatisticsParam"
)
TJobStatisticsParam
tJobStatisticsParam
);
}
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/THazardWorkPlanService.java
View file @
b35436bc
...
...
@@ -123,4 +123,16 @@ public interface THazardWorkPlanService extends SuperService<THazardWorkPlan> {
*/
Page
<
THazardWorkPlanRiverside
>
riversideList
(
THazardWorkPlanParam
param
);
/**
* 查询已完成的危险作业数量
* @return
*/
Integer
completedCount
(
List
<
String
>
orgIds
);
/**
* 查询未完成的危险作业数量
* @return
*/
Integer
unfinishedCount
(
List
<
String
>
orgIds
);
}
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanServiceImpl.java
View file @
b35436bc
...
...
@@ -2349,6 +2349,16 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
return
baseMapper
.
riversideList
(
resultPage
,
param
);
}
@Override
public
Integer
completedCount
(
List
<
String
>
orgIds
)
{
return
baseMapper
.
completedCount
(
orgIds
);
}
@Override
public
Integer
unfinishedCount
(
List
<
String
>
orgIds
)
{
return
baseMapper
.
unfinishedCount
(
orgIds
);
}
private
void
deleteDoneRecords
(
String
bizId
)
{
try
{
// 获取流程实例ID
...
...
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/partner/model/dto/TJobStatisticsParam.java
View file @
b35436bc
...
...
@@ -129,5 +129,8 @@ public class TJobStatisticsParam {
@ApiModelProperty
(
value
=
"所有父级机构主键以英文逗号隔开如:一级,二级等"
)
private
String
orgAllPath
;
@ApiModelProperty
(
value
=
"批量ID"
)
private
List
<
String
>
orgIds
;
}
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/partner/service/impl/TJobStatisticsServiceImpl.java
View file @
b35436bc
...
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.testor.biz.sys.org.model.domain.SysOrg
;
import
com.testor.biz.sys.org.service.SysOrgService
;
import
com.testor.module.hazard.dao.THazardWorkPlanDao
;
import
com.testor.module.partner.controller.TJobStatisticsController
;
import
com.testor.module.partner.dao.TJobStatisticsDao
;
import
com.testor.module.partner.model.domain.TJobStatistics
;
...
...
@@ -65,6 +66,9 @@ public class TJobStatisticsServiceImpl extends SuperServiceImpl<TJobStatisticsDa
@Value
(
"${tuan.path}"
)
private
String
path
;
@Autowired
private
THazardWorkPlanDao
hazardWorkPlanDao
;
//@XxlJob("add_JobStatistics")
//@Scheduled(cron = "0 */4 * * * ?")
@Transactional
(
isolation
=
Isolation
.
READ_COMMITTED
)
...
...
@@ -351,6 +355,70 @@ public class TJobStatisticsServiceImpl extends SuperServiceImpl<TJobStatisticsDa
@Override
public
HazardousWorkStatisticsVo
regionalStatistics
(
String
orgId
)
{
UserInfo
loginUser
=
ContextUtils
.
getLoginUser
();
if
(
StringHelper
.
isEmpty
(
orgId
))
{
orgId
=
loginUser
.
getOrgId
();
}
HazardousWorkStatisticsVo
hazardousWorkStatisticsVo
=
new
HazardousWorkStatisticsVo
();
List
<
RegionalStatisticsVO
>
regionalStatisticsVOList
=
new
ArrayList
<>();
TJobStatisticsParam
tJobStatisticsParam
=
new
TJobStatisticsParam
();
tJobStatisticsParam
.
setOrgId
(
orgId
);
String
today
=
DateUtil
.
today
();
tJobStatisticsParam
.
setZykssj
(
today
);
List
<
String
>
orgIds
=
newSysOrgService
.
getOrgIdListByParentId
(
orgId
);
//如果没有下级查看当前单位数据
if
(
orgIds
==
null
||
orgIds
.
isEmpty
())
{
regionalStatisticsVOList
=
hazardWorkPlanDao
.
selectWorkTypeCount
(
tJobStatisticsParam
);
hazardousWorkStatisticsVo
.
setCount
(
regionalStatisticsVOList
.
size
());
}
else
{
tJobStatisticsParam
.
setOrgId
(
""
);
for
(
String
id
:
orgIds
)
{
List
<
String
>
idsChildrenById
=
newSysOrgService
.
getIdsChildrenById
(
id
);
tJobStatisticsParam
.
setOrgIds
(
idsChildrenById
);
RegionalStatisticsVO
regionalStatisticsVO
=
new
RegionalStatisticsVO
();
regionalStatisticsVO
.
setId
(
id
);
SysOrg
org
=
sysOrgService
.
getById
(
id
);
if
(
null
!=
org
){
regionalStatisticsVO
.
setName
(
org
.
getOrgName
());
}
List
<
RegionalStatisticsVO
>
regionalStatisticsVOS
=
hazardWorkPlanDao
.
selectOrgWorkPlanCount
(
tJobStatisticsParam
);
if
(
null
!=
regionalStatisticsVOS
&&
!
regionalStatisticsVOS
.
isEmpty
()){
regionalStatisticsVO
.
setDone
(
regionalStatisticsVOS
.
get
(
0
).
getDone
());
regionalStatisticsVO
.
setUndone
(
regionalStatisticsVOS
.
get
(
0
).
getUndone
());
}
else
{
regionalStatisticsVO
.
setDone
(
"0"
);
regionalStatisticsVO
.
setUndone
(
"0"
);
}
regionalStatisticsVOList
.
add
(
regionalStatisticsVO
);
}
// 计算所有组织的已完成和未完成作业总数
int
totalDone
=
0
;
int
totalUndone
=
0
;
for
(
RegionalStatisticsVO
vo
:
regionalStatisticsVOList
)
{
// 将字符串转换为整数,处理可能的空值或非数字情况
try
{
totalDone
+=
Integer
.
parseInt
(
vo
.
getDone
());
}
catch
(
NumberFormatException
e
)
{
// 如果转换失败,则默认为0
}
try
{
totalUndone
+=
Integer
.
parseInt
(
vo
.
getUndone
());
}
catch
(
NumberFormatException
e
)
{
// 如果转换失败,则默认为0
}
}
int
totalCount
=
totalDone
+
totalUndone
;
hazardousWorkStatisticsVo
.
setCount
(
totalCount
);
}
hazardousWorkStatisticsVo
.
setRegionalStatistics
(
regionalStatisticsVOList
);
return
hazardousWorkStatisticsVo
;
}
/*public HazardousWorkStatisticsVo regionalStatistics(String orgId) {
UserInfo loginUser = ContextUtils.getLoginUser();
if (StringHelper.isEmpty(orgId)) {
orgId = loginUser.getOrgId();
...
...
@@ -383,7 +451,7 @@ public class TJobStatisticsServiceImpl extends SuperServiceImpl<TJobStatisticsDa
hazardousWorkStatisticsVo.setRegionalStatistics(regionalStatisticsVOList);
hazardousWorkStatisticsVo.setCount(count);
return hazardousWorkStatisticsVo;
}
}
*/
@Override
public
Long
regionalStatisticsCount
(
String
orgId
)
{
...
...
zlmy-modules/zlmy-boot/src/main/resources/mapper/hazard/THazardWorkPlan.xml
View file @
b35436bc
...
...
@@ -101,7 +101,84 @@
where parent_ids like concat('%',#{param.orgId},'%')
)
</if>
</select>
<select
id=
"completedCount"
resultType=
"java.lang.Integer"
>
select count(1) from t_hazard_work_plan
where status = '0' and work_status ='5'
and DATE(create_date) = CURRENT_DATE
<if
test=
"param.orgId != null"
>
and org_id in
<foreach
item=
"id"
collection=
"orgIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
</select>
<select
id=
"unfinishedCount"
resultType=
"java.lang.Integer"
>
select count(1) from t_hazard_work_plan
where status = '0' and work_status not in('0','6','12','5')
and DATE(create_date) = CURRENT_DATE
<if
test=
"param.orgId != null"
>
and org_id in
<foreach
item=
"id"
collection=
"orgIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
</select>
<select
id=
"selectOrgWorkPlanCount"
resultType=
"com.testor.module.partner.model.vo.RegionalStatisticsVO"
>
SELECT
o.org_id id,
o.org_name name,
COALESCE(SUM(CASE WHEN h.work_status = '5' THEN 1 ELSE 0 END), 0) as done,
COALESCE(SUM(CASE WHEN h.work_status NOT IN ('0','6','12','5') THEN 1 ELSE 0 END), 0) as undone
FROM t_sys_org o
LEFT JOIN t_hazard_work_plan h ON o.org_id = h.org_id
AND h.status = '0'
AND CAST(h.create_date AS DATE) = CURRENT_DATE
WHERE 1=1
<if
test=
"tJobStatisticsParam.orgIds != null and tJobStatisticsParam.orgIds.size()>0"
>
AND h.org_id IN
<foreach
item=
"id"
collection=
"tJobStatisticsParam.orgIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
<if
test=
"tJobStatisticsParam.orgId != null and tJobStatisticsParam.orgId !=''"
>
AND h.org_id = #{tJobStatisticsParam.orgId}
</if>
GROUP BY o.org_id, o.org_name
ORDER BY o.org_id
</select>
<select
id=
"selectWorkTypeCount"
resultType=
"com.testor.module.partner.model.vo.RegionalStatisticsVO"
>
SELECT
CASE thwp.work_status
WHEN '0' THEN '草稿'
WHEN '1' THEN '作业前(风险分析)'
WHEN '2' THEN '作业前(条件确认)'
WHEN '3' THEN '作业前(许可证)'
WHEN '4' THEN '技术交底'
WHEN '5' THEN '已关闭'
WHEN '6' THEN '已取消'
WHEN '7' THEN '已超时'
WHEN '8' THEN '驳回'
WHEN '9' THEN '审批中'
WHEN '10' THEN '进行中'
WHEN '11' THEN '待安全许可证关闭'
WHEN '12' THEN '已超时自动取消'
ELSE '未知状态'
END AS done,
tsdd.dict_value AS name
FROM t_hazard_work_plan thwp
LEFT JOIN t_sys_dict_data tsdd
ON thwp.work_type = tsdd.dict_data_id
WHERE
thwp.status = '0' -- 过滤草稿状态
AND CAST(thwp.create_date AS DATE) = CURRENT_DATE
<if
test=
"tJobStatisticsParam.orgId != null and tJobStatisticsParam.orgId !=''"
>
AND thwp.org_id = #{tJobStatisticsParam.orgId}
</if>
</select>
</mapper>
\ 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