Procházet zdrojové kódy

培训看板未签到人数统计错误修复

wy před 6 měsíci
rodič
revize
14abc71ab9

+ 17 - 3
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/service/impl/StatisticServiceImpl.java

@@ -1119,9 +1119,17 @@ public class StatisticServiceImpl implements StatisticService {
                 "FROM t_rypxcjb " +
                 "WHERE shi_fou_guo_shen_ = '已结束' %s) AS subquery";
 
-        String signSqlTemplate = "SELECT count(DISTINCT b.ren_yuan_id_) total_num from t_rypxcjb a,t_qdxxb b " +
-                " WHERE a.id_ =b.guan_lian_id_ and FIND_IN_SET(b.ren_yuan_id_,a.pei_xun_ren_yuan_) " +
-                " and a.shi_fou_guo_shen_ = '已结束' %s ";
+       // String signSqlTemplate = "SELECT count(DISTINCT b.ren_yuan_id_) total_num from t_rypxcjb a,t_qdxxb b " +
+         //       " WHERE a.id_ =b.guan_lian_id_ and FIND_IN_SET(b.ren_yuan_id_,a.pei_xun_ren_yuan_) " +
+          //      " and a.shi_fou_guo_shen_ = '已结束' %s ";
+
+
+        String signSqlTemplate = "SELECT COUNT(*) total_num " +
+                "        FROM t_rypxcjb a " +
+                "        JOIN t_qdxxb b ON a.id_ = b.guan_lian_id_ " +
+                "        WHERE a.shi_fou_guo_shen_ = '已结束' %s " ;
+
+         String str = " AND FIND_IN_SET(b.ren_yuan_id_, a.pei_xun_ren_yuan_) > 0";
 
         String sumRealSqlTemplate = "SELECT COALESCE(SUM(num),0) AS realNum FROM (" +
                 "SELECT count(id_) as num FROM t_qdxxb " +
@@ -1129,6 +1137,11 @@ public class StatisticServiceImpl implements StatisticService {
                 "WHERE shi_fou_guo_shen_ = '已结束' %s) " +
                 "GROUP BY guan_lian_id_, ren_yuan_id_) AS re";
 
+
+
+
+
+
         for (String date : dateStr) {
             TraineeStatisticsDto traineeDto = new TraineeStatisticsDto();
 
@@ -1164,6 +1177,7 @@ public class StatisticServiceImpl implements StatisticService {
             traineeDto.setNumReal(numReal);
             // 未签到人数
             // 实际参训签到(属于该培训的)
+            signSql = signSql + str;
             Map<String, Object> signMap = commonDao.queryOne(signSql);
             int numSign = Integer.parseInt(signMap==null?"0":signMap.get("total_num").toString());
             traineeDto.setNumUn(numAll==0?0:numAll-numSign);