|
@@ -1152,11 +1152,11 @@
|
|
<foreach collection="timeData" item="item" index="index">
|
|
<foreach collection="timeData" item="item" index="index">
|
|
<choose>
|
|
<choose>
|
|
<when test="index == 0">
|
|
<when test="index == 0">
|
|
- <include refid="getWarnTrendCommon" />
|
|
|
|
|
|
+ <include refid="getWarnTrendCommon"/>
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
union all
|
|
union all
|
|
- <include refid="getWarnTrendCommon" />
|
|
|
|
|
|
+ <include refid="getWarnTrendCommon"/>
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</foreach>
|
|
</foreach>
|
|
@@ -1573,94 +1573,112 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<sql id="getWarnTrendCommon">
|
|
<sql id="getWarnTrendCommon">
|
|
- <!--select
|
|
|
|
- t.hour,
|
|
|
|
- count(distinct t.examRecordId) as onlineCount,
|
|
|
|
- 0 as warnCount
|
|
|
|
|
|
+ select
|
|
|
|
+ t.hour,
|
|
|
|
+ count(t.examRecordId) as warnCount
|
|
from
|
|
from
|
|
- (
|
|
|
|
- select
|
|
|
|
- DATE_FORMAT(#{item}, '%H:%i') as hour,
|
|
|
|
- teesol.exam_record_id as examRecordId,
|
|
|
|
- DATE_FORMAT(FROM_UNIXTIME(teesol.create_time / 1000), '%Y-%m-%d %H:%i:00') as createTime
|
|
|
|
- from
|
|
|
|
- t_e_exam_student_online_log teesol
|
|
|
|
- join t_oe_exam_record toer on toer.id = teesol.exam_record_id
|
|
|
|
- join t_e_exam tee on toer.exam_id = tee.id
|
|
|
|
- WHERE 1 = 1
|
|
|
|
- <if test="orgId != null and orgId != ''">
|
|
|
|
- and tee.org_id = #{orgId}
|
|
|
|
- </if>
|
|
|
|
- and (teesol.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval 30 minute)) * 1000
|
|
|
|
- and teesol.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)) t
|
|
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ DATE_FORMAT(#{item}, '%H:%i') as hour,
|
|
|
|
+ tiiwi.exam_record_id as examRecordId,
|
|
|
|
+ DATE_FORMAT(FROM_UNIXTIME(tiiwi.create_time / 1000), '%Y-%m-%d %H:%i:00') as createTime
|
|
|
|
+ from
|
|
|
|
+ t_oe_exam_record toer
|
|
|
|
+ join t_ie_invigilate_warn_info tiiwi on
|
|
|
|
+ tiiwi.exam_record_id = toer.id
|
|
|
|
+ join t_e_exam tee on toer.exam_id = tee.id
|
|
|
|
+ WHERE 1 = 1
|
|
|
|
+ <if test="orgId != null and orgId != ''">
|
|
|
|
+ and tee.org_id = #{orgId}
|
|
|
|
+ </if>
|
|
|
|
+ and (tiiwi.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval #{scaleSize} minute)) *
|
|
|
|
+ 1000
|
|
|
|
+ and tiiwi.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)) t
|
|
where
|
|
where
|
|
- (t.createTime <![CDATA[ >= ]]> #{item} and t.createTime <![CDATA[ < ]]> date_add(#{item}, interval #{interval} minute))
|
|
|
|
- union all
|
|
|
|
- -->
|
|
|
|
- select
|
|
|
|
- t.hour,
|
|
|
|
- <!--0 as onlineCount,-->
|
|
|
|
- count(t.examRecordId) as warnCount
|
|
|
|
- from
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- DATE_FORMAT(#{item}, '%H:%i') as hour,
|
|
|
|
- tiiwi.exam_record_id as examRecordId,
|
|
|
|
- DATE_FORMAT(FROM_UNIXTIME(tiiwi.create_time / 1000), '%Y-%m-%d %H:%i:00') as createTime
|
|
|
|
- from
|
|
|
|
- t_oe_exam_record toer
|
|
|
|
- join t_ie_invigilate_warn_info tiiwi on
|
|
|
|
- tiiwi.exam_record_id = toer.id
|
|
|
|
- join t_e_exam tee on toer.exam_id = tee.id
|
|
|
|
- WHERE 1 = 1
|
|
|
|
- <if test="orgId != null and orgId != ''">
|
|
|
|
- and tee.org_id = #{orgId}
|
|
|
|
- </if>
|
|
|
|
- and (tiiwi.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval 30 minute)) * 1000
|
|
|
|
- and tiiwi.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)) t
|
|
|
|
- where
|
|
|
|
- (t.createTime <![CDATA[ >= ]]> #{item} and t.createTime <![CDATA[ < ]]> date_add(#{item}, interval #{interval} minute))
|
|
|
|
|
|
+ (t.createTime <![CDATA[ >= ]]> #{item} and t.createTime <![CDATA[ < ]]> date_add(#{item}, interval #{interval}
|
|
|
|
+ minute))
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="getTimeOnlineData" resultType="com.qmth.themis.business.bean.result.TimeOnlineDataResult">
|
|
<select id="getTimeOnlineData" resultType="com.qmth.themis.business.bean.result.TimeOnlineDataResult">
|
|
select
|
|
select
|
|
- t.hour,
|
|
|
|
- sum(t.onlineCount) as onlineCount,
|
|
|
|
- sum(t.offlineCount) as offlineCount
|
|
|
|
|
|
+ t.hour,
|
|
|
|
+ sum(t.onlineCount) as onlineCount,
|
|
|
|
+ sum(t.offlineCount) as offlineCount
|
|
from
|
|
from
|
|
(
|
|
(
|
|
|
|
+ <foreach collection="timeData" item="item" index="index">
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="index == 0">
|
|
|
|
+ <include refid="getTimeOnlineDataCommon"/>
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ union all
|
|
|
|
+ <include refid="getTimeOnlineDataCommon"/>
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </foreach>
|
|
|
|
+ ) t
|
|
|
|
+ group by
|
|
|
|
+ t.hour
|
|
|
|
+ order by
|
|
|
|
+ t.hour
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <sql id="getTimeOnlineDataCommon">
|
|
select
|
|
select
|
|
- DATE_FORMAT(FROM_UNIXTIME(teesol.create_time / 1000), '%H:%i') as hour,
|
|
|
|
- count(distinct teesol.exam_record_id) as onlineCount,
|
|
|
|
|
|
+ t.hour,
|
|
|
|
+ count(distinct t.examRecordId) as onlineCount,
|
|
0 as offlineCount
|
|
0 as offlineCount
|
|
from
|
|
from
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ DATE_FORMAT(#{item}, '%H:%i') as hour,
|
|
|
|
+ teesol.exam_record_id as examRecordId,
|
|
|
|
+ DATE_FORMAT(FROM_UNIXTIME(teesol.create_time / 1000), '%Y-%m-%d %H:%i:00') as createTime
|
|
|
|
+ from
|
|
t_e_exam_student_online_log teesol
|
|
t_e_exam_student_online_log teesol
|
|
- join t_oe_exam_record toer on toer.id = teesol.exam_record_id
|
|
|
|
- join t_e_exam tee on toer.exam_id = tee.id
|
|
|
|
|
|
+ join t_oe_exam_record toer on
|
|
|
|
+ toer.id = teesol.exam_record_id
|
|
|
|
+ join t_e_exam tee on
|
|
|
|
+ toer.exam_id = tee.id
|
|
where 1 = 1
|
|
where 1 = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
<if test="orgId != null and orgId != ''">
|
|
and tee.org_id = #{orgId}
|
|
and tee.org_id = #{orgId}
|
|
</if>
|
|
</if>
|
|
- and (teesol.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval #{scaleSize} minute)) * 1000
|
|
|
|
|
|
+ and (teesol.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval #{scaleSize} minute))
|
|
|
|
+ * 1000
|
|
and teesol.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)
|
|
and teesol.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)
|
|
- and teesol.`type` = 'ON_LINE' group by teesol.create_time
|
|
|
|
|
|
+ and teesol.`type` = 'ON_LINE') t
|
|
|
|
+ where
|
|
|
|
+ (t.createTime <![CDATA[ >= ]]> #{item} and t.createTime <![CDATA[ < ]]> date_add(#{item}, interval #{interval}
|
|
|
|
+ minute))
|
|
union all
|
|
union all
|
|
select
|
|
select
|
|
- DATE_FORMAT(FROM_UNIXTIME(teesol.create_time / 1000), '%H:%i') as hour,
|
|
|
|
|
|
+ t.hour,
|
|
0 as onlineCount,
|
|
0 as onlineCount,
|
|
- count(distinct teesol.exam_record_id) as offlineCount
|
|
|
|
|
|
+ count(distinct t.examRecordId) as offlineCount
|
|
|
|
+ from
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ DATE_FORMAT(#{item}, '%H:%i') as hour,
|
|
|
|
+ teesol.exam_record_id as examRecordId,
|
|
|
|
+ DATE_FORMAT(FROM_UNIXTIME(teesol.create_time / 1000), '%Y-%m-%d %H:%i:00') as createTime
|
|
from
|
|
from
|
|
t_e_exam_student_online_log teesol
|
|
t_e_exam_student_online_log teesol
|
|
- join t_oe_exam_record toer on toer.id = teesol.exam_record_id
|
|
|
|
- join t_e_exam tee on toer.exam_id = tee.id
|
|
|
|
|
|
+ join t_oe_exam_record toer on
|
|
|
|
+ toer.id = teesol.exam_record_id
|
|
|
|
+ join t_e_exam tee on
|
|
|
|
+ toer.exam_id = tee.id
|
|
where 1 = 1
|
|
where 1 = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
<if test="orgId != null and orgId != ''">
|
|
and tee.org_id = #{orgId}
|
|
and tee.org_id = #{orgId}
|
|
</if>
|
|
</if>
|
|
- and (teesol.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval #{scaleSize} minute)) * 1000
|
|
|
|
|
|
+ and (teesol.create_time <![CDATA[ >= ]]> unix_timestamp(date_sub(#{currentDate}, interval #{scaleSize} minute))
|
|
|
|
+ * 1000
|
|
and teesol.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)
|
|
and teesol.create_time <![CDATA[ <= ]]> unix_timestamp(#{currentDate}) * 1000)
|
|
- and teesol.`type` = 'OFF_LINE' group by teesol.create_time) t
|
|
|
|
- group by t.hour
|
|
|
|
- order by t.hour
|
|
|
|
- </select>
|
|
|
|
|
|
+ and teesol.`type` = 'OFF_LINE') t
|
|
|
|
+ where
|
|
|
|
+ (t.createTime <![CDATA[ >= ]]> #{item} and t.createTime <![CDATA[ < ]]> date_add(#{item}, interval #{interval}
|
|
|
|
+ minute))
|
|
|
|
+ </sql>
|
|
</mapper>
|
|
</mapper>
|