|
@@ -30,7 +30,6 @@
|
|
tbd.legal_holidays AS legalHolidays,
|
|
tbd.legal_holidays AS legalHolidays,
|
|
tbd.work_hours AS workHours,
|
|
tbd.work_hours AS workHours,
|
|
tbd.violation_days AS violationDays,
|
|
tbd.violation_days AS violationDays,
|
|
- tbd.ding_exception_count AS dingExceptionCount,
|
|
|
|
IFNULL(ec.cnt,0) AS exceptionCount,
|
|
IFNULL(ec.cnt,0) AS exceptionCount,
|
|
tbds.id AS submitId,
|
|
tbds.id AS submitId,
|
|
IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
@@ -39,7 +38,11 @@
|
|
tbds.submit_time AS submitTime,
|
|
tbds.submit_time AS submitTime,
|
|
tbs.service_lead_id AS serviceUnitLeaderId,
|
|
tbs.service_lead_id AS serviceUnitLeaderId,
|
|
tbc.lead_id AS regionManagerId,
|
|
tbc.lead_id AS regionManagerId,
|
|
- tbc.region_coordinator_id AS coordinatorId
|
|
|
|
|
|
+ tbc.region_coordinator_id AS coordinatorId,
|
|
|
|
+ IF(tffa.status IN ('已撤回','已终止','已结束'),
|
|
|
|
+ TIMESTAMPDIFF(DAY, FROM_UNIXTIME(SUBSTRING(tffa.create_time, 1, 10), '%Y-%m-%d'), FROM_UNIXTIME(SUBSTRING(tffa.update_time, 1, 10), '%Y-%m-%d')),
|
|
|
|
+ TIMESTAMPDIFF(DAY, FROM_UNIXTIME(SUBSTRING(tffa.create_time, 1, 10), '%Y-%m-%d'), NOW()))
|
|
|
|
+ - normal_days + 1 AS dingExceptionCount
|
|
FROM
|
|
FROM
|
|
(SELECT
|
|
(SELECT
|
|
service_id,
|
|
service_id,
|
|
@@ -58,8 +61,7 @@
|
|
AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
SUM(IF((sign_in_time IS NULL
|
|
SUM(IF((sign_in_time IS NULL
|
|
OR sign_out_time IS NULL), 1, 0)) AS violation_days,
|
|
OR sign_out_time IS NULL), 1, 0)) AS violation_days,
|
|
- SUM(IF((sign_in_time IS NULL
|
|
|
|
- OR sign_out_time IS NULL), 1, 0)) AS ding_exception_count
|
|
|
|
|
|
+ SUM(IF((sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS normal_days
|
|
FROM
|
|
FROM
|
|
t_b_ding
|
|
t_b_ding
|
|
GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
@@ -87,6 +89,8 @@
|
|
LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
|
|
+ LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.code = tbd.sop_no
|
|
|
|
+ LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
) main
|
|
) main
|
|
<where>
|
|
<where>
|
|
<if test="serviceUnitId != null">
|
|
<if test="serviceUnitId != null">
|
|
@@ -177,7 +181,6 @@
|
|
tbd.legal_holidays AS legalHolidays,
|
|
tbd.legal_holidays AS legalHolidays,
|
|
tbd.work_hours AS workHours,
|
|
tbd.work_hours AS workHours,
|
|
tbd.violation_days AS violationDays,
|
|
tbd.violation_days AS violationDays,
|
|
- tbd.ding_exception_count AS dingExceptionCount,
|
|
|
|
IFNULL(ec.cnt,0) AS exceptionCount,
|
|
IFNULL(ec.cnt,0) AS exceptionCount,
|
|
tbds.id AS submitId,
|
|
tbds.id AS submitId,
|
|
IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
@@ -186,7 +189,11 @@
|
|
tbds.submit_time AS submitTime,
|
|
tbds.submit_time AS submitTime,
|
|
tbs.service_lead_id AS serviceUnitLeaderId,
|
|
tbs.service_lead_id AS serviceUnitLeaderId,
|
|
tbc.lead_id AS regionManagerId,
|
|
tbc.lead_id AS regionManagerId,
|
|
- tbc.region_coordinator_id AS coordinatorId
|
|
|
|
|
|
+ tbc.region_coordinator_id AS coordinatorId,
|
|
|
|
+ IF(tffa.status IN ('已撤回','已终止','已结束'),
|
|
|
|
+ TIMESTAMPDIFF(DAY, FROM_UNIXTIME(SUBSTRING(tffa.create_time, 1, 10), '%Y-%m-%d'), FROM_UNIXTIME(SUBSTRING(tffa.update_time, 1, 10), '%Y-%m-%d')),
|
|
|
|
+ TIMESTAMPDIFF(DAY, FROM_UNIXTIME(SUBSTRING(tffa.create_time, 1, 10), '%Y-%m-%d'), NOW()))
|
|
|
|
+ - normal_days + 1 AS dingExceptionCount
|
|
FROM
|
|
FROM
|
|
(SELECT
|
|
(SELECT
|
|
service_id,
|
|
service_id,
|
|
@@ -205,8 +212,7 @@
|
|
AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
SUM(IF((sign_in_time IS NULL
|
|
SUM(IF((sign_in_time IS NULL
|
|
OR sign_out_time IS NULL), 1, 0)) AS violation_days,
|
|
OR sign_out_time IS NULL), 1, 0)) AS violation_days,
|
|
- SUM(IF((sign_in_time IS NULL
|
|
|
|
- OR sign_out_time IS NULL), 1, 0)) AS ding_exception_count
|
|
|
|
|
|
+ SUM(IF((sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS normal_days
|
|
FROM
|
|
FROM
|
|
t_b_ding
|
|
t_b_ding
|
|
GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
@@ -234,6 +240,8 @@
|
|
LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
|
|
+ LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.code = tbd.sop_no
|
|
|
|
+ LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
) main
|
|
) main
|
|
<where>
|
|
<where>
|
|
<if test="serviceUnitId != null">
|
|
<if test="serviceUnitId != null">
|