|
@@ -186,6 +186,42 @@ public class WorkFlowDao {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ // 20240326 要求修改为 使用 回单答复超时 字段统计,排除ZHX开头的工单
|
|
|
+ //
|
|
|
+ public List<Map<String, Object>> selectTimeoutTsCountForDayV2(Instant start, Instant end) {
|
|
|
+ String sql = "with t1 as (select order_no, city as city_id, \r\n" + //
|
|
|
+ "form_basic_data->>'serv_order' as kfno,\r\n" + //
|
|
|
+ "form_basic_data ->> 'res_is_timeout' as is_timeout, \r\n" + //
|
|
|
+ "form_basic_data->>'kd_accepttime' as kd_accepttime\r\n" + //
|
|
|
+ "from flow_form_basic\r\n" + //
|
|
|
+ "where is_effctive = '1'\r\n" + //
|
|
|
+ "and substring(form_basic_data->>'serv_order' from 1 for 3) != 'ZHX'\r\n" + //
|
|
|
+ "and form_basic_data->>'kd_accepttime' >= ? " + //
|
|
|
+ "and form_basic_data->>'kd_accepttime' <= ? ), " + //
|
|
|
+ "t2 as (select '全省' as city_id, count(1) as total_num, \r\n" + //
|
|
|
+ "count(is_timeout = 'ca9d5f1f8363440699f11b802150eb77' or null) as timeout_num,\r\n" + //
|
|
|
+ "count(is_timeout = 'ca9d5f1f8363440699f11b802150eb77' or null)::float8 / count(1) as timeout_ratio\r\n"
|
|
|
+ + "from t1),\r\n" + //
|
|
|
+ "t3 as (select city_id, count(1) as total_num, \r\n" + //
|
|
|
+ "count(is_timeout = 'ca9d5f1f8363440699f11b802150eb77' or null) as timeout_num,\r\n" + //
|
|
|
+ "count(is_timeout = 'ca9d5f1f8363440699f11b802150eb77' or null)::float8 / count(1) as timeout_ratio\r\n"
|
|
|
+ + "from t1 group by city_id)\r\n" + //
|
|
|
+ "select * from t2 union select * from t3";
|
|
|
+ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
|
|
+ .withZone(ZoneId.of("Asia/Shanghai"));
|
|
|
+ Object[] objects = new Object[] { dateFormat.format(start), dateFormat.format(end) };
|
|
|
+ int[] argTypes = new int[] { Types.TIMESTAMP, Types.TIMESTAMP };
|
|
|
+ Long startLong = System.currentTimeMillis();
|
|
|
+ List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, objects, argTypes);
|
|
|
+ log.debug("从工作流读取{}-{}超时工单数据, 耗时 {} ms...",
|
|
|
+ start,
|
|
|
+ end,
|
|
|
+ System.currentTimeMillis() - startLong);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 20240326 要求修改为 使用 回单答复超时 字段统计,排除ZHX开头的工单
|
|
|
+ @Deprecated
|
|
|
public List<Map<String, Object>> selectTimeoutTsCountForDay(Instant start, Instant end, int target) {
|
|
|
String sql = "with t1 as (select distinct city as city_id, \r\n" + //
|
|
|
"form_basic_data->>'serv_order' as kfsn,\r\n" + //
|