|
@@ -4,11 +4,11 @@
|
|
|
|
|
|
|
|
|
<resultMap id="EnforcementProcessResultMap" type="com.zfjg.manage.api.dto.enforce.job.EnforcementOrgProcess">
|
|
|
- <id property="orgId" column="orgId"/>
|
|
|
- <result property="orgName" column="orgName"/>
|
|
|
- <result property="checkNumber" column="checkNumber"/>
|
|
|
- <result property="relationNumber" column="relationNumber"/>
|
|
|
- <result property="relationRate" column="relationRate"/>
|
|
|
+ <id property="orgId" column="执法机构id"/>
|
|
|
+ <result property="orgName" column="执法机构"/>
|
|
|
+ <result property="checkNumber" column="检查数量"/>
|
|
|
+ <result property="relationNumber" column="关联数"/>
|
|
|
+ <result property="relationRate" column="关联率"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="EnforceTimeoutDtoResultMap" type="com.zfjg.manage.api.dto.enforce.job.EnforceOrgTimeoutDto">
|
|
@@ -22,10 +22,10 @@
|
|
|
|
|
|
|
|
|
<resultMap id="EnforceAverageTimeDtoResultMap" type="com.zfjg.manage.api.dto.enforce.job.EnforceOrgAverageTimeDto">
|
|
|
- <id property="orgId" column="orgId"/>
|
|
|
- <result property="orgName" column="orgName"/>
|
|
|
- <result property="orgAvgTime" column="orgAvgTime"/>
|
|
|
- <result property="headCorpsAvgTime" column="headCorpsAvgTime"/>
|
|
|
+ <id property="orgId" column="执法机构id"/>
|
|
|
+ <result property="orgName" column="执法机构"/>
|
|
|
+ <result property="orgAvgTime" column="支队平均时长"/>
|
|
|
+ <result property="headCorpsAvgTime" column="视频时长"/>
|
|
|
<result property="rate" column="rate"/>
|
|
|
</resultMap>
|
|
|
|
|
@@ -40,41 +40,56 @@
|
|
|
<if test="enforceOrgId != null and enforceOrgId != ''">
|
|
|
and enforce_org_id = #{enforceOrgId}
|
|
|
</if>
|
|
|
+ <if test="enforceOrgIds !=null and enforceOrgIds.size>0">
|
|
|
+ and enforce_org_id in
|
|
|
+ <foreach item="item" index="i" collection="enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="selectEnforcementProcess" resultMap="EnforcementProcessResultMap">
|
|
|
SELECT
|
|
|
- enforce_org_id orgId,
|
|
|
- enforce_org_name orgName,
|
|
|
- count( * ) checkNumber,
|
|
|
- sum( relationNumber ) relationNumber,
|
|
|
- round( sum( relationNumber ) / count( * ) * 100, 2 ) relationRate
|
|
|
+ 执法机构id,
|
|
|
+ ( SELECT enforce_org_name FROM enforce_organize WHERE enforce_org_id = 执法机构id ) 执法机构,
|
|
|
+ count( * ) 检查数量,
|
|
|
+ sum( 关联数 ) 关联数,
|
|
|
+ round( sum( 关联数 ) / count( * ) * 100, 2 ) 关联率
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.ID,
|
|
|
- a.enforce_org_id,
|
|
|
- a.enforce_org_name,
|
|
|
- (CASE WHEN ( SELECT count( * ) FROM enforce_video C WHERE c.is_deleted = 0 AND c.enfore_job_id = a.id ) <![CDATA[ > ]]> 0
|
|
|
- THEN '1' ELSE '0' END ) relationNumber
|
|
|
- FROM
|
|
|
- enforce_job a
|
|
|
- WHERE
|
|
|
- a.is_deleted = '0'
|
|
|
- AND a.enforce_org_id not in ('55c99876ec0f425aac6925a92cceeb17','256069491270746112')
|
|
|
- AND job_status = 'ARCHIVED'
|
|
|
- <if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
- and a.enforce_org_id = #{pm.enforceOrgId}
|
|
|
- </if>
|
|
|
- <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
- AND a.finish_time <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
- </if>
|
|
|
- <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
- AND a.finish_time <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
- </if>
|
|
|
- ) r
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ 执法机构id,
|
|
|
+ a.ID,
|
|
|
+ a.`检查对象名称`,
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN ( SELECT count( * ) FROM enforce_video C WHERE c.is_deleted = 0 AND c.enfore_job_id = a.id ) > 0 THEN
|
|
|
+ '1' ELSE '0'
|
|
|
+ END
|
|
|
+ ) 关联数
|
|
|
+ FROM
|
|
|
+ v_rw a
|
|
|
+ WHERE 是否删除 = '正常'
|
|
|
+ AND 执法机构id not in ('55c99876ec0f425aac6925a92cceeb17','256069491270746112')
|
|
|
+ <if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
+ and 执法机构id = #{pm.enforceOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and 执法机构id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
+ AND 检查期限 <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
+ AND 检查期限 <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
+ </if>
|
|
|
+ AND 状态 = '已归档'
|
|
|
+ ) r
|
|
|
GROUP BY
|
|
|
- enforce_org_id
|
|
|
- order by relationRate,enforce_org_id
|
|
|
+ 执法机构id
|
|
|
+ order by 关联率,执法机构id
|
|
|
</select>
|
|
|
|
|
|
<select id="getEnforcementJobProcessList" resultType="com.zfjg.manage.api.dto.enforce.job.EnforcementJobProcessDTO">
|
|
@@ -101,6 +116,12 @@
|
|
|
<if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
and ej.enforce_org_id = #{pm.enforceOrgId}
|
|
|
</if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and ej.enforce_org_id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="pm.executorId != null and pm.executorId != ''">
|
|
|
and ${pm.executorId} in (ej.executor_ids)
|
|
|
</if>
|
|
@@ -123,79 +144,28 @@
|
|
|
order by t.videoNum,finish_time desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectEnforceTimeout" resultMap="EnforceTimeoutDtoResultMap">
|
|
|
- SELECT
|
|
|
- *,
|
|
|
- ( normalCount + reviewCount + reportCount ) AS allCount
|
|
|
+ <select id="selectEnforceTimeout" resultType="com.zfjg.manage.api.dto.enforce.job.EnforceOrgTimeoutDto">
|
|
|
+ SELECT 执法机构id orgId,任务类型 jobType,
|
|
|
+ count( * ) jobCount
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- eo.id,
|
|
|
- eo.enforce_org_id orgId,
|
|
|
- eo.enforce_org_name orgName,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- count( 1 )
|
|
|
- FROM
|
|
|
- enforce_job a
|
|
|
- WHERE
|
|
|
- a.enforce_org_id = eo.enforce_org_id
|
|
|
- AND job_type = 'NORMAL'
|
|
|
- AND time_out = 1
|
|
|
- AND a.is_deleted = 0
|
|
|
- <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
- </if>
|
|
|
- <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
- </if>
|
|
|
- ) normalCount,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- count( 1 )
|
|
|
- FROM
|
|
|
- enforce_job a
|
|
|
- WHERE
|
|
|
- a.enforce_org_id = eo.enforce_org_id
|
|
|
- AND job_type = 'REVIEW'
|
|
|
- AND time_out = 1
|
|
|
- AND a.is_deleted = 0
|
|
|
- <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
- </if>
|
|
|
- <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
- </if>
|
|
|
- ) reviewCount,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- count( 1 )
|
|
|
- FROM
|
|
|
- enforce_job a
|
|
|
- WHERE
|
|
|
- a.enforce_org_id = eo.enforce_org_id
|
|
|
- AND job_type = 'REPORT'
|
|
|
- AND time_out = 1
|
|
|
- AND a.is_deleted = 0
|
|
|
- <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
- </if>
|
|
|
- <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
- AND a.last_enforce_date <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
- </if>
|
|
|
- ) reportCount
|
|
|
- FROM
|
|
|
- enforce_organize eo
|
|
|
- WHERE
|
|
|
- eo.is_deleted = 0
|
|
|
- AND eo.enforce_org_id not in ('55c99876ec0f425aac6925a92cceeb17','256069491270746112')
|
|
|
- <if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
- and ej.enforce_org_id = #{pm.enforceOrgId}
|
|
|
- </if>
|
|
|
- ) t
|
|
|
- ORDER BY
|
|
|
- allCount DESC,
|
|
|
- orgId
|
|
|
+ v_rw
|
|
|
+ WHERE
|
|
|
+ 是否已超时 = '已超时'
|
|
|
+ AND 是否删除 = '正常'
|
|
|
+ and 任务类型 in ('专项','复查','日常检查')
|
|
|
+ <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
+ and 检查期限 <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
+ and 检查期限 <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and 执法机构id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by 任务类型,执法机构id
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -225,6 +195,12 @@
|
|
|
<if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
and ej.enforce_org_id = #{pm.enforceOrgId}
|
|
|
</if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and ej.enforce_org_id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="pm.executorId != null and pm.executorId != ''">
|
|
|
and ${pm.executorId} in (ej.executor_ids)
|
|
|
</if>
|
|
@@ -242,51 +218,51 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectEnforceAverageTime" resultMap="EnforceAverageTimeDtoResultMap">
|
|
|
+ SELECT *, round( ( 视频时长 / 支队平均时长 ) * 100, 2 ) rate from (SELECT
|
|
|
+ 执法机构id,
|
|
|
+ ( SELECT enforce_org_name FROM enforce_organize WHERE enforce_org_id = 执法机构id ) 执法机构,
|
|
|
+ round( sum( 检查耗时 / 1000 / 60 ) / count( * ), 2 ) 支队平均时长,
|
|
|
+ round(
|
|
|
+ sum(
|
|
|
+ (
|
|
|
SELECT
|
|
|
- *,
|
|
|
- round( ( headCorpsAvgTime / orgAvgTime ) * 100, 2 ) rate
|
|
|
+ sum( CASE WHEN media_id = '-1' THEN duration ELSE TIMESTAMPDIFF( SECOND, video_begin_time, video_end_time ) END ) zfzsc
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.enforce_org_id orgId,
|
|
|
- a.enforce_org_name orgName,
|
|
|
- round( sum( a.time_consuming / 1000 / 60 ) / count( * ), 2 ) orgAvgTime,
|
|
|
- round(
|
|
|
- sum(
|
|
|
- (
|
|
|
- SELECT
|
|
|
- sum( CASE WHEN media_id = '-1' THEN duration ELSE TIMESTAMPDIFF( SECOND, video_begin_time, video_end_time ) END ) zfzsc
|
|
|
- FROM
|
|
|
- enforce_video C
|
|
|
- WHERE
|
|
|
- c.is_deleted = 0
|
|
|
- AND c.enfore_job_id = a.id
|
|
|
- )
|
|
|
- ) / count( * ) / 60,
|
|
|
- 2
|
|
|
- ) headCorpsAvgTime
|
|
|
- FROM
|
|
|
- enforce_job a
|
|
|
- WHERE
|
|
|
- a.is_deleted = '0'
|
|
|
- AND a.job_status = 'ARCHIVED'
|
|
|
- AND a.enforce_org_id not in ('55c99876ec0f425aac6925a92cceeb17','256069491270746112')
|
|
|
- AND a.job_type = 'NORMAL'
|
|
|
- and a.time_consuming <![CDATA[ <= ]]> 28800000
|
|
|
- <if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
- and a.enforce_org_id = #{pm.enforceOrgId}
|
|
|
- </if>
|
|
|
- <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
- AND a.finish_time <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
- </if>
|
|
|
- <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
- AND a.finish_time <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- a.enforce_org_id
|
|
|
- ) t
|
|
|
+ enforce_video C
|
|
|
+ WHERE
|
|
|
+ c.is_deleted = 0
|
|
|
+ AND c.enfore_job_id = a.id
|
|
|
+ )
|
|
|
+ ) / count( * ) / 60,
|
|
|
+ 2
|
|
|
+ ) 视频时长
|
|
|
+ FROM
|
|
|
+ v_rw a
|
|
|
+ WHERE
|
|
|
+ 状态 = '已归档'
|
|
|
+ <if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
+ and 执法机构id = #{pm.enforceOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and 执法机构id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="pm.startDate != null and pm.startDate !=''">
|
|
|
+ AND `开始执行任务时间` <![CDATA[ >= ]]> #{pm.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="pm.endDate != null and pm.endDate !=''">
|
|
|
+ AND 开始执行任务时间 <![CDATA[ <= ]]> #{pm.endDate}
|
|
|
+ </if>
|
|
|
+ AND 是否删除 = '正常'
|
|
|
+ AND 检查耗时 <![CDATA[ <= ]]> 28800000
|
|
|
+ AND 执法机构id not in ('55c99876ec0f425aac6925a92cceeb17','256069491270746112')
|
|
|
+ AND 任务类型 = '日常检查'
|
|
|
+ GROUP BY
|
|
|
+ 执法机构id) t
|
|
|
ORDER BY
|
|
|
- rate,orgId
|
|
|
+ rate,执法机构id
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -328,6 +304,12 @@
|
|
|
<if test="pm.enforceOrgId != null and pm.enforceOrgId != ''">
|
|
|
and ej.enforce_org_id = #{pm.enforceOrgId}
|
|
|
</if>
|
|
|
+ <if test="pm.enforceOrgIds !=null and pm.enforceOrgIds.size>0">
|
|
|
+ and ej.enforce_org_id in
|
|
|
+ <foreach item="item" index="i" collection="pm.enforceOrgIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="pm.executorId != null and pm.executorId != ''">
|
|
|
and ${pm.executorId} in (ej.executor_ids)
|
|
|
</if>
|