|
|
@@ -122,7 +122,7 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
|
|
|
String dateCondition = "";String year = "";
|
|
|
|
|
|
- // 在岗培训人员统计情况
|
|
|
+ // 在岗人员培训统计情况
|
|
|
if (dates.contains("-")){
|
|
|
year = dates.substring(0,4);
|
|
|
// 月
|
|
|
@@ -826,8 +826,12 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
"FROM t_rypxcjb " +
|
|
|
"WHERE ji_hua_lei_xing_ = '在岗培训' AND shi_fou_guo_shen_ = '已结束' %s) AS subquery";
|
|
|
|
|
|
- String realSqlTemplate = "SELECT COUNT(*) AS realNum FROM (" +
|
|
|
- "SELECT id_ FROM t_qdxxb " +
|
|
|
+ String signSqlTemplate = "SELECT COALESCE(SUM(total),0) AS total_num from (SELECT count(b.id_) total 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.ji_hua_lei_xing_ = '在岗培训' AND a.shi_fou_guo_shen_ = '已结束' %s GROUP BY guan_lian_id_, ren_yuan_id_) as qq";
|
|
|
+
|
|
|
+ String sumRealSqlTemplate = "SELECT COALESCE(SUM(num),0) AS realNum FROM (" +
|
|
|
+ "SELECT count(id_) as num FROM t_qdxxb " +
|
|
|
"WHERE guan_lian_id_ IN (SELECT id_ FROM t_rypxcjb " +
|
|
|
"WHERE ji_hua_lei_xing_ = '在岗培训' AND shi_fou_guo_shen_ = '已结束' %s) " +
|
|
|
"GROUP BY guan_lian_id_, ren_yuan_id_) AS re";
|
|
|
@@ -835,7 +839,7 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
for (String date : dateStr) {
|
|
|
TraineeStatisticsDto traineeDto = new TraineeStatisticsDto();
|
|
|
|
|
|
- String dateCondition = "";
|
|
|
+ String dateCondition = "";String params;
|
|
|
if ("year".equals(type)) {
|
|
|
traineeDto.setDayName(date + "月");
|
|
|
date = Integer.parseInt(date)<10?year + "-0" + date : year + "-" + date;
|
|
|
@@ -848,22 +852,28 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
}
|
|
|
|
|
|
if (BeanUtils.isNotEmpty(dept)) {
|
|
|
+ params = dateCondition + String.format(" AND a.bian_zhi_bu_men_ = '%s'", dept);
|
|
|
dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s'", dept);
|
|
|
+ }else {
|
|
|
+ params = dateCondition + String.format(" AND a.di_dian_ = '%s'", getDiDian());
|
|
|
}
|
|
|
dateCondition += String.format(" AND di_dian_ = '%s'", getDiDian());
|
|
|
String countSql = String.format(countSqlTemplate, dateCondition);
|
|
|
- String realSql = String.format(realSqlTemplate, dateCondition);
|
|
|
-
|
|
|
+ String sumRealSql = String.format(sumRealSqlTemplate, dateCondition);
|
|
|
+ String signSql = String.format(signSqlTemplate, params);
|
|
|
+ // 应该签到总数
|
|
|
Map<String, Object> countResult = commonDao.queryOne(countSql);
|
|
|
int numAll = Integer.parseInt(countResult.get("total_num").toString());
|
|
|
traineeDto.setNumAll(numAll);
|
|
|
-
|
|
|
- Map<String, Object> realResult = commonDao.queryOne(realSql);
|
|
|
- int numReal = Integer.parseInt(realResult.get("realNum").toString());
|
|
|
+ // 总签到人数
|
|
|
+ Map<String, Object> realResult = commonDao.queryOne(sumRealSql);
|
|
|
+ int numReal = Integer.parseInt(realResult==null?"0":realResult.get("realNum").toString());
|
|
|
traineeDto.setNumReal(numReal);
|
|
|
-
|
|
|
// 未签到人数
|
|
|
- traineeDto.setNumUn(numAll == 0 ? 0 : numAll - numReal);
|
|
|
+ // 实际参训签到(属于该培训的)
|
|
|
+ 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);
|
|
|
|
|
|
statisticsDtoList.add(traineeDto);
|
|
|
}
|