|
@@ -90,97 +90,7 @@
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-<!-- <select id="query" resultType="com.qmth.sop.business.bean.result.TBDingCountQueryResult">-->
|
|
|
|
-<!-- SELECT * from (-->
|
|
|
|
-<!-- SELECT-->
|
|
|
|
-<!-- bs.NAME service,-->
|
|
|
|
-<!-- d.sop_no,-->
|
|
|
|
-<!-- c.NAME custom,-->
|
|
|
|
-<!-- ua.province,-->
|
|
|
|
-<!-- ua.city,-->
|
|
|
|
-<!-- crm.exam_start_time,-->
|
|
|
|
-<!-- crm.exam_end_time,-->
|
|
|
|
-<!-- u.real_name user_name,-->
|
|
|
|
-<!-- ua.`code` user_no,-->
|
|
|
|
-<!-- r.`name` role_name,-->
|
|
|
|
-<!-- s.NAME supplier,-->
|
|
|
|
-<!-- count( d.id ) attendance,-->
|
|
|
|
-<!-- SUM( CASE WHEN d.date_type = 'WEEKDAY' THEN 1 ELSE 0 END ) weekdays,-->
|
|
|
|
-<!-- SUM( CASE WHEN d.date_type = 'WEEKEND' THEN 1 ELSE 0 END ) weekends,-->
|
|
|
|
-<!-- SUM( CASE WHEN d.date_type = 'LEGAL_HOLIDAYS' THEN 1 ELSE 0 END ) holidays,-->
|
|
|
|
-<!-- SUM( CASE WHEN d.sign_out_time is not null and d.sign_in_time is not null THEN TIMESTAMPDIFF(HOUR, DATE_FORMAT(FROM_UNIXTIME(d.sign_out_time), '%Y-%m-%d %H:%i:%s'), DATE_FORMAT(FROM_UNIXTIME(d.sign_in_time), '%Y-%m-%d %H:%i:%s')) ELSE 0 END ) work_hours,-->
|
|
|
|
-<!-- DATEDIFF(DATE_FORMAT(FROM_UNIXTIME(crm.exam_start_time), '%Y-%m-%d'), DATE_FORMAT(FROM_UNIXTIME(crm.exam_end_time), '%Y-%m-%d'))-count( d.id )+1 violation_days,-->
|
|
|
|
-<!-- f.`status`,-->
|
|
|
|
-<!-- sub.real_name submitter,-->
|
|
|
|
-<!-- f.create_time submission_time ,-->
|
|
|
|
-<!-- d.service_id,-->
|
|
|
|
-<!-- f.create_id,-->
|
|
|
|
-<!-- s.id supplier_id-->
|
|
|
|
|
|
|
|
-<!-- FROM-->
|
|
|
|
-<!-- t_b_ding d-->
|
|
|
|
-<!-- LEFT JOIN sys_user u ON u.id = d.user_id-->
|
|
|
|
-<!-- LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number-->
|
|
|
|
-<!-- LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id-->
|
|
|
|
-<!-- LEFT JOIN t_b_service bs ON bs.id = d.service_id-->
|
|
|
|
-<!-- LEFT JOIN t_b_sop_info sop ON sop.crm_no = d.crm_no-->
|
|
|
|
-<!-- AND sop.sop_no = d.sop_no-->
|
|
|
|
-<!-- LEFT JOIN t_b_engineer_allocation ea ON ea.crm_no = d.crm_no-->
|
|
|
|
-<!-- AND ea.sop_no = d.sop_no-->
|
|
|
|
-<!-- LEFT JOIN sys_role r ON ea.role_id = r.id-->
|
|
|
|
-<!-- LEFT JOIN t_b_crm crm ON crm.crm_no = d.crm_no-->
|
|
|
|
-<!-- LEFT JOIN sys_custom c ON c.id = sop.custom_id-->
|
|
|
|
-<!-- LEFT JOIN t_f_flow_approve f ON f.flow_id = d.flow_id-->
|
|
|
|
-<!-- LEFT JOIN sys_user sub ON sub.id = f.create_id-->
|
|
|
|
-<!-- LEFT JOIN sys_supplier s ON s.id = us.supplier_id-->
|
|
|
|
-<!-- GROUP BY-->
|
|
|
|
-<!-- bs.NAME,-->
|
|
|
|
-<!-- d.sop_no,-->
|
|
|
|
-<!-- c.NAME,-->
|
|
|
|
-<!-- ua.province,-->
|
|
|
|
-<!-- ua.city,-->
|
|
|
|
-<!-- crm.exam_start_time,-->
|
|
|
|
-<!-- crm.exam_end_time,-->
|
|
|
|
-<!-- u.real_name,-->
|
|
|
|
-<!-- ua.`code`,-->
|
|
|
|
-<!-- r.`name`,-->
|
|
|
|
-<!-- s.NAME,-->
|
|
|
|
-<!-- f.`status`,-->
|
|
|
|
-<!-- f.create_id,-->
|
|
|
|
-<!-- f.create_time,-->
|
|
|
|
-<!-- d.service_id,-->
|
|
|
|
-<!-- s.id ) a-->
|
|
|
|
-
|
|
|
|
-<!-- <where>-->
|
|
|
|
-<!-- <if test="serviceId != null and serviceId != ''">-->
|
|
|
|
-<!-- and a.service_id = #{serviceId}-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="status != null and status != ''">-->
|
|
|
|
-<!-- and a.status = #{status}-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="createId != null and createId != ''">-->
|
|
|
|
-<!-- and a.create_id = #{create_id}-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="userName != null and userName != ''">-->
|
|
|
|
-<!-- and a.real_name like concat('%', #{userName} , '%')-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="supplierId != null and supplierId != ''">-->
|
|
|
|
-<!-- and a.supplier_id = #{supplierId}-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="custom != null and custom != ''">-->
|
|
|
|
-<!-- and a.name like concat('%', #{custom} , '%')-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="sopNo != null and sopNo != ''">-->
|
|
|
|
-<!-- and a.sop_no like concat('%', #{sopNo} , '%')-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- <if test="days != null and days != '' ">-->
|
|
|
|
-<!-- <![CDATA[-->
|
|
|
|
-<!-- and a.days > #{days}-->
|
|
|
|
-<!-- ]]>-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
-<!-- </where>-->
|
|
|
|
-
|
|
|
|
-<!-- </select>-->
|
|
|
|
|
|
|
|
|
|
|
|
<select id="count" resultType="com.qmth.sop.business.bean.result.TBDingCountResult">
|
|
<select id="count" resultType="com.qmth.sop.business.bean.result.TBDingCountResult">
|
|
@@ -313,6 +223,26 @@
|
|
<if test="status != null and status != ''">
|
|
<if test="status != null and status != ''">
|
|
and a.status = #{status}
|
|
and a.status = #{status}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="abnormal != null and abnormal != ''">
|
|
|
|
+ and a.user_id in ( SELECT x.user_id from(
|
|
|
|
+
|
|
|
|
+ SELECT
|
|
|
|
+
|
|
|
|
+ d.user_id,sum(case when d.sign_time is null then 1 else 0 end) count
|
|
|
|
+ FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT d.*,d.axis_in_x AS axis_x, d.axis_in_y AS axis_y,d.sign_in_address address, d.sign_in_time sign_time,'IN' AS type FROM t_b_ding d UNION ALL
|
|
|
|
+ SELECT d.*,d.axis_out_x AS axis_x, d.axis_out_y AS axis_y,d.sign_out_address address, d.sign_out_time sign_time,'OUT' AS type FROM t_b_ding d
|
|
|
|
+ where
|
|
|
|
+ d.sign_out_time is not null or
|
|
|
|
+ (d.sign_out_time is null and
|
|
|
|
+ date_format(from_unixtime(d.create_time/1000),'%Y-%m-%d') != date_format(now(),'%Y-%m-%d'))
|
|
|
|
+ ) d
|
|
|
|
+
|
|
|
|
+ GROUP BY d.user_id
|
|
|
|
+
|
|
|
|
+ )x where x.count>=#{abnormal})
|
|
|
|
+ </if>
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasBusiness">
|
|
<when test="dpr.hasBusiness">
|
|
@@ -341,20 +271,22 @@
|
|
<select id="attendanceCount" resultType="com.qmth.sop.business.bean.result.TBDingAttendanceCountResult">
|
|
<select id="attendanceCount" resultType="com.qmth.sop.business.bean.result.TBDingAttendanceCountResult">
|
|
SELECT
|
|
SELECT
|
|
count( d.id ) total,
|
|
count( d.id ) total,
|
|
- SUM( CASE WHEN f.`status`!='FINISH' THEN 1 ELSE 0 END ) abnormal,
|
|
|
|
- SUM( CASE WHEN f.`status`='FINISH' THEN 1 ELSE 0 END ) all_days,
|
|
|
|
- SUM( CASE WHEN f.`status`='FINISH' THEN TIMESTAMPDIFF(HOUR, DATE_FORMAT(FROM_UNIXTIME(d.sign_out_time), '%Y-%m-%d %H:%i:%s'), DATE_FORMAT(FROM_UNIXTIME(d.sign_in_time), '%Y-%m-%d %H:%i:%s')) ELSE 0 END ) all_hours
|
|
|
|
|
|
+ sum( CASE WHEN d.sign_in_time IS NULL THEN 1 ELSE 0 END )+ sum( CASE WHEN d.sign_out_time IS NULL THEN 1 ELSE 0 END ) abnormal,
|
|
|
|
+ SUM( CASE WHEN d.sign_in_time IS NOT NULL AND d.sign_out_time IS NOT NULL THEN 1 ELSE 0 END ) all_days,
|
|
|
|
+ SUM( CASE WHEN d.sign_in_time IS NOT NULL AND d.sign_out_time IS NOT NULL THEN
|
|
|
|
+ (d.sign_out_time-d.sign_in_time)
|
|
|
|
+ ELSE 0
|
|
|
|
+ END
|
|
|
|
+ )/1000/60/60 all_hours
|
|
FROM
|
|
FROM
|
|
t_b_ding d
|
|
t_b_ding d
|
|
LEFT JOIN sys_user u ON u.id = d.user_id
|
|
LEFT JOIN sys_user u ON u.id = d.user_id
|
|
LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
|
|
LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
|
|
LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
|
|
LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
|
|
- LEFT JOIN t_b_sop_info sop ON sop.crm_no = d.crm_no
|
|
|
|
- AND sop.sop_no = d.sop_no
|
|
|
|
- LEFT JOIN sys_custom c ON c.id = sop.custom_id
|
|
|
|
- LEFT JOIN t_f_flow_approve f ON f.flow_id = d.flow_id
|
|
|
|
- LEFT JOIN t_b_service tbs ON d.service_id = tbs.id AND tbs.enable
|
|
|
|
- LEFT JOIN t_b_crm tbc ON d.crm_no = tbc.crm_no
|
|
|
|
|
|
+ LEFT JOIN t_b_crm crm ON crm.crm_no = d.crm_no
|
|
|
|
+ LEFT JOIN sys_custom c ON c.id = crm.custom_id
|
|
|
|
+
|
|
|
|
+ LEFT JOIN t_b_service tbs ON d.service_id = tbs.id
|
|
|
|
|
|
<where>
|
|
<where>
|
|
|
|
|