一公司企业端驾驶舱危险作业统计显示

main
limingyu 2023-12-15 13:59:11 +08:00
parent 98dc83e051
commit 6937054d44
5 changed files with 591 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import com.zcloud.service.system.DepartmentService;
import com.zcloud.service.system.DictionariesService; import com.zcloud.service.system.DictionariesService;
import com.zcloud.service.system.UsersService; import com.zcloud.service.system.UsersService;
import com.zcloud.util.Jurisdiction; import com.zcloud.util.Jurisdiction;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -48,7 +49,12 @@ public class HomeHighRiskWorkController extends BaseController {
/*风险管控 数据统计*/ /*风险管控 数据统计*/
//获取高危作业统计数据(申请数[COUNTAPPLY],审批中[COUNTAPPROVE],归档[COUNTARCHIVE] //获取高危作业统计数据(申请数[COUNTAPPLY],审批中[COUNTAPPROVE],归档[COUNTARCHIVE]
PageData data = highworkService.statisticsHighRiskWorkByState(pd); PageData data = new PageData();
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6",pd.getString("CORPINFO_ID"))) { //一公司
data = highworkService.statisticsHighRiskWorkByStateFirst(pd);
} else {
data = highworkService.statisticsHighRiskWorkByState(pd);
}
map.put("pd", data); map.put("pd", data);
map.put("result", errInfo); map.put("result", errInfo);
@ -70,7 +76,12 @@ public class HomeHighRiskWorkController extends BaseController {
pd = this.getPageData(); pd = this.getPageData();
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业
page.setPd(pd); page.setPd(pd);
List<PageData> varList = highworkService.listHighRiskWork(page); List<PageData> varList = new ArrayList<>();
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6",pd.getString("CORPINFO_ID"))) { // 一公司
varList = highworkService.listHighRiskWorkFirst(page);
} else {
varList = highworkService.listHighRiskWork(page);
}
map.put("varList", varList); map.put("varList", varList);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
@ -93,7 +104,12 @@ public class HomeHighRiskWorkController extends BaseController {
Map<String, Object> chartData = new HashMap<String, Object>(); Map<String, Object> chartData = new HashMap<String, Object>();
List<String> legendData = Arrays.asList(new String[]{"动火作业", "临时用电作业", "盲板作业", "高处作业", "有限空间作业", "吊装作业"}); List<String> legendData = Arrays.asList(new String[]{"动火作业", "临时用电作业", "盲板作业", "高处作业", "有限空间作业", "吊装作业"});
List<PageData> workChart = highworkService.statisticsAllHighRiskWork(pd); //统计高危作业里各作业数 List<PageData> workChart = new ArrayList<>();
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6",pd.getString("CORPINFO_ID"))) { //一公司
workChart = highworkService.statisticsAllHighRiskWorkFirst(pd); //统计高危作业里各作业数
} else {
workChart = highworkService.statisticsAllHighRiskWork(pd); //统计高危作业里各作业数
}
List seriesData = new ArrayList(); List seriesData = new ArrayList();
for (int i = 0; i < legendData.size(); i++) { for (int i = 0; i < legendData.size(); i++) {
PageData pie = new PageData(); PageData pie = new PageData();

View File

@ -100,5 +100,17 @@ public interface HighWorkMapper{
List<PageData> listAllHighRiskWorkLocation(PageData pd); List<PageData> listAllHighRiskWorkLocation(PageData pd);
void editacceptancapplication(PageData pd); void editacceptancapplication(PageData pd);
List<PageData> listHighRiskWorkFirst(Page page);
PageData statisticsHighRiskWorkByStateFirst(PageData pd);
/**
*
* @param pd
* @return
* @throws Exception
*/
List<PageData> statisticsAllHighRiskWorkFirst(PageData pd);
} }

View File

@ -103,5 +103,29 @@ public interface HighWorkService{
* @throws Exception * @throws Exception
*/ */
List<PageData> listAllHighRiskWorkLocation(PageData pd)throws Exception; List<PageData> listAllHighRiskWorkLocation(PageData pd)throws Exception;
/**
*
* @param page
* @return
* @throws Exception
*/
List<PageData> listHighRiskWorkFirst(Page page)throws Exception;
/**
* [COUNTAPPLY][COUNTAPPROVE][COUNTARCHIVE]
* @param pd
* @return
* @throws Exception
*/
PageData statisticsHighRiskWorkByStateFirst(PageData pd)throws Exception;
/**
*
* @param pd
* @return
* @throws Exception
*/
List<PageData> statisticsAllHighRiskWorkFirst(PageData pd)throws Exception;
} }

View File

@ -176,5 +176,26 @@ public class HighWorkServiceImpl implements HighWorkService {
public List<PageData> listAllHighRiskWorkLocation(PageData pd) throws Exception { public List<PageData> listAllHighRiskWorkLocation(PageData pd) throws Exception {
return highworkMapper.listAllHighRiskWorkLocation(pd); return highworkMapper.listAllHighRiskWorkLocation(pd);
} }
@Override
public List<PageData> listHighRiskWorkFirst(Page page) throws Exception {
return highworkMapper.listHighRiskWorkFirst(page);
}
@Override
public PageData statisticsHighRiskWorkByStateFirst(PageData pd) throws Exception {
return highworkMapper.statisticsHighRiskWorkByStateFirst(pd);
}
/**
*
* @param pd
* @return
* @throws Exception
*/
@Override
public List<PageData> statisticsAllHighRiskWorkFirst(PageData pd) throws Exception {
return highworkMapper.statisticsAllHighRiskWorkFirst(pd);
}
} }

View File

@ -877,4 +877,519 @@
) f ) f
</select> </select>
<select id="listHighRiskWorkFirst" resultType="com.zcloud.entity.PageData">
SELECT * FROM
(SELECT
f.HOTWORK_ID ID,
f.CHECK_NO WORK_NUMBER,
'动火作业' WORK_TYPE,
CASE
f.APPLY_STATUS
WHEN 0 THEN '动火作业待提交'
WHEN 1 THEN '作业负责人待审核'
WHEN 2 THEN '所在单位待审核'
WHEN 4 THEN '安全管理部门待审核'
WHEN 5 THEN '动火审批人待审核'
WHEN 6 THEN '班长待验票'
WHEN 7 THEN '待验收'
END STATUS_NAME,
CASE WHEN f.APPLY_STATUS = 0 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u1.NAME, '/', ',' )),
IFNULL( qu1.`NAME`, '' ))
WHEN f.APPLY_STATUS = 1 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u1.NAME, '/', ',' )),
IFNULL( qu1.`NAME`, '' ))
WHEN f.APPLY_STATUS = 2 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u2.NAME, '/', ',' )),
IFNULL( qu2.`NAME`, '' ))
WHEN f.APPLY_STATUS = 4 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u3.NAME, '/', ',' )),
IFNULL( qu3.`NAME`, '' ))
WHEN f.APPLY_STATUS = 5 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u4.NAME, '/', ',' )),
IFNULL( qu4.`NAME`, '' ))
WHEN f.APPLY_STATUS = 6 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u5.NAME, '/', ',' )),
IFNULL( qu5.`NAME`, '' ))
WHEN f.APPLY_STATUS = 7 THEN
IFNULL(
GROUP_CONCAT(
REPLACE ( u6.NAME, '/', ',' )),
IFNULL( qu6.`NAME`, '' ))
ELSE
IFNULL(
GROUP_CONCAT(
REPLACE ( u6.NAME, '/', ',' )),
IFNULL( qu6.`NAME`, '' ))
END USER_NAME,
DATE_FORMAT( ifnull( f.OPERATTIME, f.CREATTIME ), '%Y-%m-%d %H:%i:%s' ) OPERATTIME
FROM
bus_hotwork_cfd f
LEFT JOIN sys_user u1 ON u1.USER_ID = f.CONFIRM_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu1 ON qu1.USER_ID = f.CONFIRM_USER_ID
LEFT JOIN sys_user u2 ON u2.USER_ID = f.LEADER_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu2 ON qu2.USER_ID = f.LEADER_USER_ID
LEFT JOIN sys_user u3 ON u3.USER_ID = f.AUDIT_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu3 ON qu3.USER_ID = f.AUDIT_USER_ID
LEFT JOIN sys_user u4 ON u4.USER_ID = f.APPROVE_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu4 ON qu4.USER_ID = f.APPROVE_USER_ID
LEFT JOIN sys_user u5 ON u5.USER_ID = f.MONITOR_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu5 ON qu5.USER_ID = f.MONITOR_USER_ID
LEFT JOIN sys_user u6 ON u6.USER_ID = f.ACCEPT_USER_ID
LEFT JOIN `qa-gwj-regulatory`.sys_user qu6 ON qu6.USER_ID = f.ACCEPT_USER_ID
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS >= 0
AND f.APPLY_STATUS != 8
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
GROUP BY f.HOTWORK_ID
UNION ALL
SELECT f.ID, f.WORK_NUMBER, f.WORK_TYPE, f.STATUS_NAME, u.NAME USER_NAME, f.OPERATTIME
FROM
(SELECT
f.electricity_ID ID,
f.CHECK_NO WORK_NUMBER,
'临时用电作业' WORK_TYPE,
case f.APPLY_STATUS
when '0' then '待提交'
when '1' then '待确认'
when '2' then '待审批'
when '3' then '已归档'
when '4' then '已验收'
when '-1' then '已打回'
END STATUS_NAME,
case f.APPLY_STATUS
when '0' then f.APPLY_USER_ID
when '1' then f.ASSURE_USER_ID
when '2' then f.APPROVE_USER_ID
when '3' then f.ACCEPT_USER_ID
when '-1' then f.APPLY_USER_ID
END NEXT_USER_ID,
ifnull(f.OPERATTIME,f.CREATTIME) OPERATTIME
FROM bus_electricity f WHERE f.ISDELETE = '0' AND f.APPLY_STATUS NOT IN ('3','4')
AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i')
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
) f
LEFT JOIN sys_user u ON u.USER_ID = f.NEXT_USER_ID
UNION ALL
SELECT f.ID, f.WORK_NUMBER, f.WORK_TYPE, f.STATUS_NAME, u.NAME USER_NAME, f.OPERATTIME
FROM
(SELECT
f.blindboard_ID ID,
f.CHECK_NO WORK_NUMBER,
'盲板作业' WORK_TYPE,
case f.APPLY_STATUS
when '1' then '待确认'
when '2' then '待审批'
when '3' then '已归档'
when '4' then '已打回'
END STATUS_NAME,
case f.APPLY_STATUS
when '1' then bb.OPERATION_UNIT_PERSONCHARGE
when '2' then bb.CORPINFO_APPROVER
when '3' then f.APPLY_USER_ID
when '4' then f.APPLY_USER_ID
END NEXT_USER_ID,
ifnull(f.OPERATTIME,f.CREATTIME) OPERATTIME
FROM bus_blindboard f
LEFT JOIN bus_blindboardinfo bb ON bb.BLINDBOARD_ID = f.BLINDBOARD_ID
WHERE f.ISDELETE = '0' AND f.APPLY_STATUS NOT IN ('3','4')
AND date_format(now(),'%Y-%m-%d %H:%i') >= bb.BOARD_INSTALL_TIME AND bb.BOARD_DISASSEMBLE_TIME >= date_format(now(),'%Y-%m-%d %H:%i')
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
) f
LEFT JOIN sys_user u ON u.USER_ID = f.NEXT_USER_ID
UNION ALL
SELECT f.ID, f.WORK_NUMBER, f.WORK_TYPE, f.STATUS_NAME, u.NAME USER_NAME, f.OPERATTIME
FROM
(SELECT
f.HIGHWORK_ID ID,
f.CHECK_NO WORK_NUMBER,
'高处作业' WORK_TYPE,
case f.APPLY_STATUS
when '0' then '待提交'
when '1' then '待确认'
when '2' then '待审核'
when '3' then '待审批'
when '4' then '已归档'
when '5' then '已验收'
when '-2' then '确认打回'
when '-3' then '审核打回'
when '-4' then '审批打回'
when '55' then '待验收'
END STATUS_NAME,
case f.APPLY_STATUS
when '1' then f.CONSTRUCTION_USER_ID
when '2' then f.AUDIT_USER_ID
when '3' then f.APPROVE_USER_ID
when '-2' then f.CREATOR
when '-3' then f.CREATOR
when '-4' then f.CREATOR
when '55' then f.ACCEPT_USER_ID
END NEXT_USER_ID,
ifnull(f.OPERATTIME,f.CREATTIME) OPERATTIME
FROM bus_highwork f WHERE f.ISDELETE = '0' AND f.APPLY_STATUS NOT IN ('4','5','55','-5')
AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i')
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
) f
LEFT JOIN sys_user u ON u.USER_ID = f.NEXT_USER_ID
UNION ALL
SELECT f.ID, f.WORK_NUMBER, f.WORK_TYPE, f.STATUS_NAME, u.NAME USER_NAME, f.OPERATTIME
FROM
(SELECT
f.confinedspace_ID ID,
f.WORK_PERMIT_NUMBER WORK_NUMBER,
'有限空间作业' WORK_TYPE,
case f.APPLY_STATUS
when '1' then '待采样'
when '2' then '作业单位责任人确认'
when '3' then '作业现场责任人审核'
when '4' then '管理单位责任人审批'
when '5' then '作业单位责任人验收'
when '6' then '管理单位责任人验收'
when '-2' then '作业单位责任人确认打回'
when '-3' then '作业现场责任人审核打回'
when '-4' then '管理单位责任人审批打回'
when '-5' then '作业单位责任人验收打回'
when '-6' then '管理单位责任人验收打回'
END STATUS_NAME,
case f.APPLY_STATUS
when '1' then f.SAMPLING_ANALYST_ID
when '2' then f.WORK_UNIT_MANAGER_ID
when '3' then f.JOB_SITE_MANAGER_ID
when '4' then f.MANAGEMENT_UNIT_ID
when '5' then f.WORK_UNIT_MANAGER_ID
when '6' then f.MANAGEMENT_UNIT_ID
when '-2' then f.CREATOR
when '-3' then f.CREATOR
when '-4' then f.CREATOR
when '-5' then f.CREATOR
when '-6' then f.CREATOR
END NEXT_USER_ID,
ifnull(f.OPERATTIME,f.CREATTIME) OPERATTIME
FROM bus_confinedspace f WHERE f.ISDELETE = '0' AND f.APPLY_STATUS != '7'
AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i')
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
) f
LEFT JOIN sys_user u ON u.USER_ID = f.NEXT_USER_ID
UNION ALL
SELECT f.ID, f.WORK_NUMBER, f.WORK_TYPE, f.STATUS_NAME, u.NAME USER_NAME, f.OPERATTIME
FROM
(SELECT
f.hoisting_ID ID,
f.NUMBERING WORK_NUMBER,
'吊装作业' WORK_TYPE,
case f.APPLY_STATUS
when '0' then '待提交'
when '1' then '待确认'
when '2' then '待审核'
when '3' then '待审批'
when '4' then '已归档'
when '5' then '已验收'
when '-2' then '确认打回'
when '-3' then '审核打回'
when '-4' then '审批打回'
when '55' then '待验收'
END STATUS_NAME,
case f.APPLY_STATUS
when '1' then f.CONSTRUCTION_JOB_MANAGER_ID
when '2' then f.WORK_UNIT_MANAGER_ID
when '3' then f.BRANCH_APPROVER_ID
when '-2' then f.CREATOR
when '-3' then f.CREATOR
when '-4' then f.CREATOR
when '55' then f.ACCEPTOR_ID
END NEXT_USER_ID,
ifnull(f.OPERATTIME,f.CREATTIME) OPERATTIME
FROM bus_hoisting f
WHERE f.ISDELETE = '0' AND f.APPLY_STATUS NOT IN ('4','5','55','-5')
AND date_format(now(),'%Y-%m-%d %H:%i') >= f.JOB_START_TIME AND f.JOB_END_TIME >= date_format(now(),'%Y-%m-%d %H:%i')
<if test="pd.CORPINFO_ID!= null and pd.CORPINFO_ID!=''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ids!= null and pd.ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="pd.ids" open="(" separator="," close=")">
#{pd.ids[${index}]}
</foreach>
</if>
) f
LEFT JOIN sys_user u ON u.USER_ID = f.NEXT_USER_ID
) f
ORDER BY f.OPERATTIME DESC
</select>
<select id="statisticsHighRiskWorkByStateFirst" resultType="com.zcloud.entity.PageData">
SELECT
SUM(f.COUNTAPPLY) COUNTAPPLY,SUM(f.COUNTAPPROVE) COUNTAPPROVE,SUM(f.COUNTARCHIVE) COUNTARCHIVE
FROM (
SELECT
COUNT( CASE WHEN f.APPLY_STATUS > 0 THEN f.HOTWORK_ID END ) COUNTAPPLY,
COUNT( CASE WHEN f.APPLY_STATUS > 0 AND f.APPLY_STATUS != 8 THEN f.HOTWORK_ID END ) COUNTAPPROVE,
COUNT( CASE WHEN f.APPLY_STATUS = 8 THEN f.HOTWORK_ID END ) COUNTARCHIVE
FROM bus_hotwork_cfd f WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT
(
SELECT
count( 1 )
FROM
bus_electricity f
WHERE
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND (
f.APPLY_STATUS != '0' AND f.APPLY_STATUS NOT IN ('3','4')
AND date_format( now(), '%Y-%m-%d %H:%i' ) >= f.WORK_START_DATE
AND f.WORK_END_DATE >= date_format( now(), '%Y-%m-%d %H:%i' )
OR f.APPLY_STATUS IN ( '3', '4' )
)
) COUNTAPPLY,
COUNT(case when f.APPLY_STATUS != '0' AND f.APPLY_STATUS NOT IN ('3','4') AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i') then f.ELECTRICITY_ID end) COUNTAPPROVE,
COUNT(case when f.APPLY_STATUS IN ('3','4') then f.ELECTRICITY_ID end) COUNTARCHIVE
FROM bus_electricity f WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT
(
SELECT
count( 1 )
FROM
bus_blindboard f
LEFT JOIN
bus_blindboardinfo bb ON bb.BLINDBOARD_ID = f.BLINDBOARD_ID
WHERE
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND (
f.APPLY_STATUS != '0' AND f.APPLY_STATUS != '3'
AND date_format( now(), '%Y-%m-%d %H:%i' ) >= bb.BOARD_INSTALL_TIME
AND bb.BOARD_DISASSEMBLE_TIME >= date_format( now(), '%Y-%m-%d %H:%i' )
OR f.APPLY_STATUS = '3'
)
) COUNTAPPLY,
COUNT(case when f.APPLY_STATUS != '0' AND f.APPLY_STATUS != '3' AND date_format(now(),'%Y-%m-%d %H:%i') >= bb.BOARD_INSTALL_TIME AND bb.BOARD_DISASSEMBLE_TIME >= date_format(now(),'%Y-%m-%d %H:%i') then f.BLINDBOARD_ID end) COUNTAPPROVE,
COUNT(case when f.APPLY_STATUS = '3' then f.BLINDBOARD_ID end) COUNTARCHIVE
FROM bus_blindboard f
LEFT JOIN bus_blindboardinfo bb ON bb.BLINDBOARD_ID = f.BLINDBOARD_ID
WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT
(
SELECT
count( 1 )
FROM
bus_highwork f
WHERE
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND (
f.APPLY_STATUS != '0' AND f.APPLY_STATUS NOT IN ('4','55','5','-5')
AND date_format( now(), '%Y-%m-%d %H:%i' ) >= f.WORK_START_DATE
AND f.WORK_END_DATE >= date_format( now(), '%Y-%m-%d %H:%i' )
OR f.APPLY_STATUS IN ( '4', '55', '5', '-5' )
)
) COUNTAPPLY,
COUNT(case when f.APPLY_STATUS != '0' AND f.APPLY_STATUS NOT IN ('4','55','5','-5') AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i') then f.HIGHWORK_ID end) COUNTAPPROVE,
COUNT(case when f.APPLY_STATUS in ('4','55','5','-5') then f.HIGHWORK_ID end) COUNTARCHIVE
FROM bus_highwork f WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT
(
SELECT
count(1)
FROM
bus_confinedspace f
WHERE
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND (
f.APPLY_STATUS != '0' and f.APPLY_STATUS != '7'
AND date_format( now(), '%Y-%m-%d %H:%i' ) >= f.WORK_START_DATE
AND f.WORK_END_DATE >= date_format( now(), '%Y-%m-%d %H:%i' )
OR f.APPLY_STATUS = '7'
)
) COUNTAPPLY,
COUNT(case when f.APPLY_STATUS != '0' and f.APPLY_STATUS != '7' AND date_format(now(),'%Y-%m-%d %H:%i') >= f.WORK_START_DATE AND f.WORK_END_DATE >= date_format(now(),'%Y-%m-%d %H:%i') then f.CONFINEDSPACE_ID end) COUNTAPPROVE,
COUNT(case when f.APPLY_STATUS = '7' then f.CONFINEDSPACE_ID end) COUNTARCHIVE
FROM bus_confinedspace f WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT
(
SELECT
count( 1 )
FROM
bus_hoisting f
WHERE
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND (
f.APPLY_STATUS != '0' and f.APPLY_STATUS not in ('4','55','5','-5')
AND date_format( now(), '%Y-%m-%d %H:%i' ) >= f.JOB_START_TIME
AND f.JOB_END_TIME >= date_format( now(), '%Y-%m-%d %H:%i' )
OR f.APPLY_STATUS IN ( '4', '55', '5', '-5' )
)
) COUNTAPPLY,
COUNT(case when f.APPLY_STATUS != '0' and f.APPLY_STATUS not in ('4','55','5','-5') AND date_format(now(),'%Y-%m-%d %H:%i') >= f.JOB_START_TIME AND f.JOB_END_TIME >= date_format(now(),'%Y-%m-%d %H:%i') then f.HOISTING_ID end) COUNTAPPROVE,
COUNT(case when f.APPLY_STATUS IN ('4','55','5','-5') then f.HOISTING_ID end) COUNTARCHIVE
FROM bus_hoisting f WHERE f.ISDELETE = '0'
<if test="CORPINFO_ID!= null and CORPINFO_ID!=''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="ids!= null and ids.size()>0">
AND f.CORPINFO_ID IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
) f
</select>
<select id="statisticsAllHighRiskWorkFirst" resultType="com.zcloud.entity.PageData">
SELECT count(*) COUNT FROM bus_hotwork_cfd f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
UNION ALL
SELECT count(*) COUNT FROM bus_electricity f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
UNION ALL
SELECT count(*) COUNT FROM bus_blindboard f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
UNION ALL
SELECT count(*) COUNT FROM bus_highwork f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
UNION ALL
SELECT count(*) COUNT FROM bus_confinedspace f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
UNION ALL
SELECT count(*) COUNT FROM bus_hoisting f WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
</select>
</mapper> </mapper>