소스 검색

服务申请单管理,列表上增加统计数字看板

hu 2 달 전
부모
커밋
72b35e149b

+ 18 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/SQL/服务申请单状态统计.sql

@@ -0,0 +1,18 @@
+select
+    ifnull(SUM(CASE WHEN t1.status = '待分配' THEN 1 ELSE 0 END),0) noacceptCount,
+	ifnull(SUM(CASE WHEN t1.status = '待分配' and t1.submitdate < DATE_SUB(NOW(), INTERVAL 24 HOUR) THEN 1 ELSE 0 END),0) noacceptCount24,
+	ifnull(SUM(CASE WHEN t1.status = '拒绝受理' THEN 1 ELSE 0 END),0) refuseacceptCount,
+	ifnull(SUM(CASE WHEN (t1.status = '待服务' or t1.status='服务中') THEN 1 ELSE 0 END),0) processingCount
+    FROM sa_serviceorder t1
+    LEFT JOIN sys_enterprise t2 ON t1.sys_enterpriseid = t2.sys_enterpriseid
+    AND t1.siteid = t2.siteid
+    LEFT JOIN sa_agents t3 ON t2.sys_enterpriseid = t3.sys_enterpriseid
+    AND t2.siteid = t3.siteid
+    LEFT JOIN sys_enterprise t4 ON t1.sys_enterpriseid_service = t4.sys_enterpriseid
+    AND t1.siteid = t4.siteid
+    LEFT JOIN sa_agents t5 ON t4.sys_enterpriseid = t5.sys_enterpriseid
+    AND t4.siteid = t5.siteid
+    left join sys_hr t7 on t7.hrid=t1.saler_hrid and t7.siteid=t1.siteid
+    left join (SELECT * FROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY sa_serviceorderid ORDER BY sa_serviceorderitemsid ASC) AS rowno FROM sa_serviceorderitems) t WHERE rowno = 1) t8 on t8.sa_serviceorderid=t1.sa_serviceorderid and t8.siteid=t1.siteid
+    left join plm_item t9 on t9.itemid=t8.itemid and t9.siteid=t8.siteid
+where t1.siteid=$siteid$ and $where$

+ 25 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/serviceorder.java

@@ -435,6 +435,21 @@ public class serviceorder extends Controller {
             if (whereObject.containsKey("sa_customersid") && !"".equals(whereObject.getString("sa_customersid"))) {
                 where.append(" and t1.sa_customersid ='").append(whereObject.getString("sa_customersid")).append("'");
             }
+
+            if(whereObject.getBooleanValue("noacceptCount")){
+                where.append(" and t1.status = '待分配' ");
+            }
+            if(whereObject.getBooleanValue("noacceptCount24")){
+                where.append(" and t1.status = '待分配' and t1.submitdate < DATE_SUB(NOW(), INTERVAL 24 HOUR) ");
+            }
+            if(whereObject.getBooleanValue("refuseacceptCount")){
+                where.append(" and t1.status = '拒绝受理' ");
+            }
+            if(whereObject.getBooleanValue("processingCount")){
+                where.append(" and (t1.status = '待服务' or t1.status='服务中') ");
+            }
+
+
         }
         SQLFactory sqlFactory = new SQLFactory(this, "服务申请单列表查询");
         sqlFactory.addParameter("siteid", siteid);
@@ -445,6 +460,16 @@ public class serviceorder extends Controller {
         querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t0.siteid='111'", "*");
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
+
+
+        SQLFactory sqlFactory2 = new SQLFactory(this, "服务申请单状态统计");
+        sqlFactory2.addParameter("siteid", siteid);
+        sqlFactory2.addParameter_SQL("where", where);
+        Rows rows_total = dbConnect.runSqlQuery(sqlFactory2.getSQL());
+
+        if (!rows.isEmpty()) {
+            rows.get(0).put("rows_total", rows_total);
+        }
         return getSucReturnObject().setData(rows).toString();
     }