Kaynağa Gözat

培训看板调整

szjbdgzl 1 yıl önce
ebeveyn
işleme
54e53ef94e

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

@@ -72,9 +72,6 @@ public class StatisticServiceImpl implements StatisticService {
         List<TrainingDashBoardDTO> list = new ArrayList<>();
         TrainingDashBoardDTO dashBoardDTO = new TrainingDashBoardDTO();
 
-        // 在岗培训计划  自动创建  or 手动创建
-        dashBoardDTO.setPlanDto(getPlanRate(dept));
-
         // 近一周发布计划
         dashBoardDTO.setWeekDtoList(getLastSeven(dept));
 
@@ -135,6 +132,9 @@ public class StatisticServiceImpl implements StatisticService {
             dateCondition = String.format(" AND DATE_FORMAT(pei_xun_shi_jian_, '%%Y') = '%s'", dates);
         }
 
+        // 在岗培训计划  自动创建  or 手动创建
+        dashBoardDTO.setPlanDto(getPlanRate(dept,dateCondition));
+
         // 在岗个人培训次数排名
         dashBoardDTO.setUserRankList(getUserTrainRank(dept,dateCondition));
 
@@ -621,19 +621,20 @@ public class StatisticServiceImpl implements StatisticService {
         }
     }
 
-    public TrainGuardAutoPlanDto getPlanRate(String dept){
+    public TrainGuardAutoPlanDto getPlanRate(String dept,String dateCondition){
         TrainGuardAutoPlanDto planDto = new TrainGuardAutoPlanDto();
-        String zdSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb " +
+        String planSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb " +
                 "where di_dian_='"+getDiDian()+"') and ji_hua_lei_xing_='在岗培训' %s";
-        String zsSql = "select count(*) as total from t_rypxcjb where ji_hua_lei_xing_='在岗培训' %s ";
-        String dateCondition = String.format(" AND di_dian_ = '%s' and shi_fou_guo_shen_='已结束' ", getDiDian());
+        String sumSql = "select count(*) as total from t_rypxcjb where ji_hua_lei_xing_='在岗培训' %s ";
+        String condition = String.format(" AND di_dian_ = '%s' and shi_fou_guo_shen_='已结束' ", getDiDian());
         if (BeanUtils.isNotEmpty(dept)){
-            dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);
+            condition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);
         }
-        zdSql = String.format(zdSql,dateCondition);
-        zsSql = String.format(zsSql,dateCondition);
-        int autoNum = Integer.parseInt(commonDao.queryOne(zdSql).get("auto").toString());
-        int total = Integer.parseInt(commonDao.queryOne(zsSql).get("total").toString());
+        condition += dateCondition;
+        planSql = String.format(planSql,condition);
+        sumSql = String.format(sumSql,condition);
+        int autoNum = Integer.parseInt(commonDao.queryOne(planSql).get("auto").toString());
+        int total = Integer.parseInt(commonDao.queryOne(sumSql).get("total").toString());
         int manual = total - autoNum;
         planDto.setTotal(total);
         planDto.setAutoNum(autoNum);
@@ -684,8 +685,7 @@ public class StatisticServiceImpl implements StatisticService {
         List<TrainRateDto> rateDtoList = new ArrayList<>();
         String sql = "select pei_xun_lei_xing_,count(pei_xun_lei_xing_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
                 "and shi_fou_guo_shen_='已结束' %s group by pei_xun_lei_xing_";
-        String talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_xing_,COUNT(pei_xun_lei_xing_)as nums " +
-                "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' %s GROUP BY pei_xun_lei_xing_) as qw";
+        String talSql = "SELECT COUNT(*) as total_num from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' %s ";
         dateCondition += String.format(" AND di_dian_ = '%s' ", getDiDian());
         if (BeanUtils.isNotEmpty(dept)){
             dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);
@@ -715,8 +715,7 @@ public class StatisticServiceImpl implements StatisticService {
         List<TrainRateDto> rateDtoList = new ArrayList<>();
         String sql = "select pei_xun_lei_bie_,count(pei_xun_lei_bie_)as nums from t_rypxcjb where ji_hua_lei_xing_='在岗培训' " +
                 " and shi_fou_guo_shen_='已结束' %s group by pei_xun_lei_bie_";
-        String talSql = "SELECT COALESCE(SUM(nums), 0) AS total_num from (select pei_xun_lei_bie_,COUNT(pei_xun_lei_bie_)as nums " +
-                "from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' %s GROUP BY pei_xun_lei_bie_) as qw";
+        String talSql = "select COUNT(*) AS total_num from t_rypxcjb where ji_hua_lei_xing_='在岗培训' and shi_fou_guo_shen_='已结束' %s ";
         dateCondition += String.format(" AND di_dian_ = '%s' ", getDiDian());
         if (BeanUtils.isNotEmpty(dept)){
             dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);