ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -126,15 +126,18 @@ // 直接从已有聚合结果推算total,避免去掉分页后再全量查一遍大表 long total = 0L; try { long wzx = map.get("wzx") != null ? ((Number) map.get("wzx")).longValue() : 0L; long ysf = map.get("ysf") != null ? ((Number) map.get("ysf")).longValue() : 0L; long dsf = map.get("dsf") != null ? ((Number) map.get("dsf")).longValue() : 0L; long yc = map.get("yc") != null ? ((Number) map.get("yc")).longValue() : 0L; long jg = map.get("jg") != null ? ((Number) map.get("jg")).longValue() : 0L; long fssb = map.get("fssb") != null ? ((Number) map.get("fssb")).longValue() : 0L; long yfs = map.get("yfs") != null ? ((Number) map.get("yfs")).longValue() : 0L; long blq = map.get("blq") != null ? ((Number) map.get("blq")).longValue() : 0L; total = wzx + ysf + dsf + yc + jg + fssb + yfs + blq; // * wzx: 未执行数量 // * ysf: 已随访数量 // * fssb: 发送失败数量 // * yfs: 已发送数量 // * dsf: 待随访数量 // long wzx = map.get("wzx") != null ? ((Number) map.get("wzx")).longValue() : 0L; // long ysf = map.get("ysf") != null ? ((Number) map.get("ysf")).longValue() : 0L; // long dsf = map.get("dsf") != null ? ((Number) map.get("dsf")).longValue() : 0L; // long fssb = map.get("fssb") != null ? ((Number) map.get("fssb")).longValue() : 0L; total = map.get("total") != null ? ((Number) map.get("total")).longValue() : 0L; } catch (Exception e) { // 兜底:全量count serviceSubtaskEntity.setPageNum(null); smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -411,18 +411,18 @@ // 处理空异常 if (MapUtils.isEmpty(result)) { result = new HashMap<>(); // 确保所有 key 都有值,避免空指针异常 // MyBatis 的 SUM 在没有匹配行时会返回 null result.putIfAbsent("wzx", 0); result.putIfAbsent("ysf", 0); result.putIfAbsent("yc", 0); result.putIfAbsent("jg", 0); result.putIfAbsent("fssb", 0); result.putIfAbsent("yfs", 0); result.putIfAbsent("blq", 0); result.putIfAbsent("dsf", 0); result.putIfAbsent("total", 0); } // 确保所有 key 都有值,避免空指针异常 // MyBatis 的 SUM 在没有匹配行时会返回 null result.putIfAbsent("wzx", 0); result.putIfAbsent("ysf", 0); result.putIfAbsent("yc", 0); result.putIfAbsent("jg", 0); result.putIfAbsent("fssb", 0); result.putIfAbsent("yfs", 0); result.putIfAbsent("blq", 0); result.putIfAbsent("dsf", 0); return result; } smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -2127,7 +2127,8 @@ SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf, SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq, SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc, SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg, COUNT(1) as total FROM service_subtask where 1=1 and del_flag = 0