|
@@ -45,15 +45,19 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
|
|
|
* accuracy string list 正确率
|
|
|
* errorNums int list 报错页数
|
|
|
*/
|
|
|
-
|
|
|
+ sql.append("select a.correctNums,a.overtimeNums, ");
|
|
|
+ sql.append("a.notCorrectNums,a.notCommentNums, ");
|
|
|
+ sql.append("a.repeatNums,concat(floor(100*(a.totalNums- a.errorNums-a.notCorrectNums)/a.totalNums),'%') as accuracy,a.errorNums,a.teacherId,a.teacherName,a.subject,a.allSubject ");
|
|
|
+ sql.append(" from (");
|
|
|
listInfo(params,queryParams,sql);
|
|
|
+ sql.append(" ) a");
|
|
|
return dao.findPage(sql.toString(),queryParams.toArray(),initPage);
|
|
|
}
|
|
|
|
|
|
private void listInfo(Map<String, Object> params,List<Object> queryParams,StringBuffer sql){
|
|
|
- sql.append("select t.teacher_id,t11.name as teacherName,t11.course_name as subject,t11.course_name as allSubject, \n");
|
|
|
- sql.append(" t.correct_nums as correctNums,t.overtime_nums as overtimeNums,t.not_correct_nums as notCorrectNums, \n");
|
|
|
- sql.append(" t.not_comment_nums as notCommentNums,t.repeat_nums as repeatNums,t.accuracy,t.error_nums as errorNums \n");
|
|
|
+ sql.append("select t.teacher_id as teacherId,t11.name as teacherName,t11.course_name as subject,t11.course_name as allSubject, \n");
|
|
|
+ sql.append(" sum(t.correct_nums) as correctNums,sum(t.overtime_nums) as overtimeNums,sum(t.not_correct_nums) as notCorrectNums, \n");
|
|
|
+ sql.append(" sum(t.not_comment_nums) as notCommentNums,sum(t.repeat_nums) as repeatNums,round(avg(t.accuracy),2) as accuracy,sum(t.error_nums) as errorNums,sum(t.total_nums) as totalNums \n");
|
|
|
sql.append(" from plat_teacher_statistics t \n");
|
|
|
sql.append(" left join tb_lib_manager t11 on t.teacher_id = t11.user_id \n");
|
|
|
sql.append(" where t11.type = 30 \n");
|
|
@@ -69,6 +73,8 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
|
|
|
sql.append(" and t11.name like concat('%',?,'%') ");
|
|
|
queryParams.add(params.get("teacherName"));
|
|
|
}
|
|
|
+
|
|
|
+ sql.append(" group by t11.user_id ");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -133,9 +139,9 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
|
|
|
errorNums int list 报错页数
|
|
|
*/
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
- sql.append("select ifnull(sum(a.overtimeNums),0) as correctTotalNums,ifnull(sum(overtimeNums),0) as overtimeTotalNums, ");
|
|
|
+ sql.append("select ifnull(sum(a.correctNums),0) as correctTotalNums,ifnull(sum(overtimeNums),0) as overtimeTotalNums, ");
|
|
|
sql.append("ifnull(sum(a.notCorrectNums),0) as notCorrectTotalNums,ifnull(sum(notCommentNums),0) as notCommentTotalNums, ");
|
|
|
- sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,round(ifnull(avg(accuracy),0),2) as accuracyTotal ");
|
|
|
+ sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,concat(floor(100*(sum(a.totalNums)- sum(a.errorNums)-sum(a.notCorrectNums))/sum(a.totalNums)),'%') as accuracyTotal,ifnull(sum(errorNums),0) as errorTotalNums ");
|
|
|
sql.append(" from (");
|
|
|
List<Object> queryParams = new ArrayList<>();
|
|
|
listInfo(params,queryParams,sql);
|
|
@@ -148,21 +154,23 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
List<Object> queryParams = new ArrayList<>();
|
|
|
sql.append("SELECT a.teacher_id,a.teacher_name,a.`subject`,a.all_subject,a.correct_nums,a.overtime_nums,a.not_correct_nums,a.not_comment_nums,a.repeat_nums,a.error_nums,\n");
|
|
|
- sql.append("floor(100*(a.total- a.error_nums-a.not_correct_nums)/a.total) as accuracy\n");
|
|
|
+ sql.append("floor(100*(a.total- a.error_nums-a.not_correct_nums)/a.total) as accuracy,a.calculate_date,a.total as total_nums\n");
|
|
|
sql.append("from (\n");
|
|
|
sql.append("SELECT t12.name as teacher_name,t.teacher_id,t.`subject`,t12.course_name as all_subject,count(if(t.is_mark in (0,2) and t.is_feedback=1,true,NULL)) as correct_nums, \n");
|
|
|
- sql.append("0 as overtime_nums,\n");
|
|
|
+ sql.append("count(if(t.is_feedback=1 and (DATE_FORMAT(t.create_time,'%H:%i')>='20:30' and DATE_FORMAT(t11.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(DATE_ADD(t.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n" +
|
|
|
+ " or (DATE_FORMAT(t.create_time,'%H:%i')<'20:30' and DATE_FORMAT(t11.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(t.create_time,'%Y-%m-%d'),' 23:59:59')),true,null)) as overtime_nums,\n");
|
|
|
sql.append("count(1) as total,\n");
|
|
|
- sql.append("count(if(t11.start_time is null,true,null)) as not_correct_nums,\n");
|
|
|
+ sql.append("DATE_FORMAT(t.create_time,'%Y-%m-%d') as calculate_date,\n");
|
|
|
+ sql.append("count(if(t.is_feedback=0 and t.is_mark in (0,2),true,null)) as not_correct_nums,\n");
|
|
|
sql.append("count(if(t.is_mark=10,true,null)) as not_comment_nums,\n");
|
|
|
sql.append("count(if(t.is_mark=15,true,null)) as repeat_nums,\n");
|
|
|
sql.append("count(if(t11.is_check_error=1,true,null)) as error_nums\n");
|
|
|
sql.append("from scon_homework_picture t \n");
|
|
|
- sql.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id and t11.type = 8\n");
|
|
|
+ sql.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id \n");
|
|
|
sql.append("left join tb_lib_manager t12 on t.teacher_id = t12.user_id\n");
|
|
|
- sql.append("where t12.type = 30 and to_days(t.create_time)= to_days(?)\n");
|
|
|
+ sql.append("where t12.type = 30 and t11.type = 8 and to_days(t.create_time)<= to_days(?)\n");
|
|
|
queryParams.add(dateTime);
|
|
|
- sql.append("GROUP BY t.teacher_id\n");
|
|
|
+ sql.append("GROUP BY t.teacher_id,to_days(t.create_time)\n");
|
|
|
sql.append(")a");
|
|
|
return dao.findList(sql.toString(),queryParams.toArray(),ListVO.class);
|
|
|
}
|
|
@@ -171,26 +179,26 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
|
|
|
public List<TeacherSalarysVO> addTeacherSalarysData(String month) {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
List<Object> queryParams = new ArrayList<>();
|
|
|
- sql.append("SELECT a.correct_nums,a.teacher_id,a.overtime_nums,a.perk_nums,a.error_nums,a.work_date,a.`month`,a.`year`,FLOOR(a.sum_perk)/a.perk_nums as perk_efficiency,Floor(100*(a.correct_nums-a.error_nums)/a.correct_nums) as accuracy,\n");
|
|
|
- sql.append("(a.perk_nums-a.error_nums)*0.15 as perk_salary,(a.correct_nums-a.perk_nums-a.error_nums)*0.15 as other_salary,a.create_time\n" );
|
|
|
+ sql.append("SELECT a.correct_nums,a.teacher_id,a.overtime_nums,a.perk_nums,a.error_nums,a.work_date,FLOOR(a.sum_perk)/a.perk_nums as perk_efficiency,Floor(100*(a.correct_nums-a.error_nums)/a.correct_nums) as accuracy,\n");
|
|
|
+ sql.append(" case when a.perk_nums<134 and a.sum_perk<120 then 20 else (a.perk_nums-a.error_nums)*0.15 end as perk_salary\n" );
|
|
|
+ sql.append(",(a.correct_nums-a.perk_nums-a.error_nums)*0.15 as other_salary\n" );
|
|
|
sql.append("from (\n" );
|
|
|
sql.append("SELECT\n" );
|
|
|
sql.append("count(1) as correct_nums,\n" );
|
|
|
- sql.append("0 as overtime_nums,\n" );
|
|
|
- sql.append("count(IF(DATE_FORMAT(t.start_time,'%H:%s')>='18:00' and DATE_FORMAT(t.start_time,'%H:%s')<='20:00',TRUE,null)) as perk_nums,\n" );
|
|
|
+ sql.append("count(if((DATE_FORMAT(t11.create_time,'%i:%s')>='20:30' and DATE_FORMAT(t.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(DATE_ADD(t11.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
|
|
|
+ sql.append(" or (DATE_FORMAT(t11.create_time,'%H:%i')<'20:30' and DATE_FORMAT(t.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(t11.create_time,'%Y-%m-%d'),' 23:59:59')),true,null)) as overtime_nums,\n");
|
|
|
+ sql.append("count(IF(DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00',TRUE,null)) as perk_nums,\n" );
|
|
|
sql.append("count(IF(t.is_check_error=1,TRUE,null)) as error_nums,\n" );
|
|
|
- sql.append("DATE_FORMAT(t.start_time,'%Y-%m-%d') as work_date,\n" );
|
|
|
- sql.append("2 as month,\n" );
|
|
|
- sql.append("2021 as year,\n" );
|
|
|
- sql.append("NOW() as create_time,\n" );
|
|
|
- sql.append("sum(IF(DATE_FORMAT(t.start_time,'%H:%s')>='18:00' and DATE_FORMAT(t.start_time,'%H:%s')<='20:00',t.correction_time,0)) as sum_perk,\n" );
|
|
|
+ sql.append("DATE_FORMAT(t.end_time,'%Y-%m-%d') as work_date,\n" );
|
|
|
+ sql.append("sum(IF(DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00',t.correction_time,0)) as sum_perk,\n" );
|
|
|
sql.append("t11.teacher_id,\n" );
|
|
|
sql.append("t.end_time,\n" );
|
|
|
sql.append("t.start_time \n" );
|
|
|
sql.append("from scon_homework_picture_correct t \n" );
|
|
|
sql.append("join scon_homework_picture t11 on t.homework_picture_id = t11.id\n" );
|
|
|
- sql.append("where t.type=8 and t11.is_mark in(0,2) \n" );
|
|
|
- sql.append("and t.start_time like '%2021-02%'\n" );
|
|
|
+ sql.append("where t.type=8 and t11.is_mark in(0,2) and t11.is_feedback=1 \n" );
|
|
|
+ sql.append("and t.end_time like concat('%',?,'%')\n" );
|
|
|
+ queryParams.add(month);
|
|
|
sql.append("GROUP BY t11.teacher_id\n" );
|
|
|
sql.append(") a");
|
|
|
return dao.findList(sql.toString(),queryParams.toArray(),TeacherSalarysVO.class);
|