Pārlūkot izejas kodu

薪酬统计修改

shenhao 3 gadi atpakaļ
vecāks
revīzija
042634dcf8

+ 8 - 5
src/main/java/com/ssj/statistics/dao/impl/StatisticsQueryImpl.java

@@ -183,9 +183,9 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         sql.append("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-a.perk_overtime_nums<134 and a.perk_nums-a.perk_overtime_nums>0  and floor(a.sum_perk/a.perk_nums)<120 then 20 \n");
         sql.append("     when a.perk_nums = a.perk_overtime_nums then (a.perk_overtime_nums-a.error_overtime_nums)*0.075 \n");
-        sql.append(" else (a.perk_nums-a.perk_overtime_nums-a.error_overtime_nums)*0.15+(a.perk_overtime_nums-a.error_overtime_nums)*0.075 end as perk_salary,\n");
-        sql.append("case when a.correct_nums-a.perk_nums-a.overtime_nums+a.perk_overtime_nums=0 then (a.correct_nums-a.perk_nums)*0.075 \n");
-        sql.append("     else (a.correct_nums-a.perk_nums-a.overtime_nums+a.perk_overtime_nums)*0.15+(a.overtime_nums-a.perk_overtime_nums)*0.075 end as other_salary\n");
+        sql.append(" else  (a.perk_nums-a.perk_overtime_nums-a.perk_error_nums+a.error_overtime_nums)*0.15+(a.perk_overtime_nums-a.error_overtime_nums)*0.075 end as perk_salary,\n");
+        sql.append("case when a.correct_nums-a.perk_nums-a.overtime_nums+a.perk_overtime_nums=0 then (a.correct_nums-a.perk_nums-a.error_nums+a.perk_error_nums)*0.075 \n");
+        sql.append("     else (a.correct_nums-a.perk_nums-a.overtime_nums+a.perk_overtime_nums-a.error_nums+a.perk_error_nums+a.error_overtime_nums2-a.error_overtime_nums)*0.15+(a.overtime_nums-a.perk_overtime_nums-a.error_overtime_nums2+a.error_overtime_nums)*0.075 end as other_salary\n");
         sql.append("from (\n");
         sql.append("SELECT\n");
         sql.append("count(1) as correct_nums,\n");
@@ -195,8 +195,11 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         sql.append("count(IF(DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00' and ((DATE_FORMAT(t11.create_time,'%H:%i')>='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 perk_overtime_nums,\n");
         sql.append("count(IF(t.is_check_error=1,TRUE,null)) as error_nums,\n");
-        sql.append("count(IF(t.is_check_error=1 and ((DATE_FORMAT(t11.create_time,'%H:%i')>='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("count(IF(t.is_check_error=1 and  DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00',TRUE,null)) as perk_error_nums,\n");
+        sql.append("count(IF(t.is_check_error=1 and  DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00' and ((DATE_FORMAT(t11.create_time,'%H:%i')>='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 error_overtime_nums,\n");
+        sql.append("count(IF(t.is_check_error=1 and ((DATE_FORMAT(t11.create_time,'%H:%i')>='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 error_overtime_nums2,\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");
@@ -261,7 +264,7 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         List<Object> queryParams = new ArrayList<>();
         sql.append("select t.work_date as workDate,t.correct_nums as  correctNums,  \n");
         sql.append("t.overtime_nums as overtimeNums,t.correct_nums as  perkNums,  \n");
-        sql.append(" t.perk_efficiency as perkEfficiency,t.error_nums as  errorNums,  \n");
+        sql.append(" SEC_TO_TIME(t.perk_efficiency) as perkEfficiency,t.error_nums as  errorNums,  \n");
         sql.append(" t.accuracy,t.perk_salary as  perkSalary,  \n");
         sql.append(" t.other_salary as otherSalary,t.salary as  salary  \n");
         sql.append("from tb_teacher_salary t \n");

+ 2 - 1
src/main/java/com/ssj/statistics/service/impl/StatisticsServiceImpl.java

@@ -131,7 +131,7 @@ public class StatisticsServiceImpl  extends BaseServiceImpl<PlatTeacherStatistic
                 boolean add = true;
                 if(payList.size()>0){
                     for(TeacherPay pay :payList){
-                        if(pay.getTeacherId().equals(vo.getTeacherId()) && pay.getWorkDate().equals(vo.getWorkDate())){
+                        if(pay.getTeacherId().equals(vo.getTeacherId()) && pay.getWorkDate().equals(vo.getWorkDate()) && vo.getPerkNums()<134){
                             pay.setPerkSalary("20");
                             add = false;
                             break;
@@ -145,6 +145,7 @@ public class StatisticsServiceImpl  extends BaseServiceImpl<PlatTeacherStatistic
                     pay.setYear(year);
                     pay.setCreateTime(new Date());
                     pay.setPerkSalary("20");
+                    pay.setSalary(new BigDecimal(pay.getPerkSalary()));
                     payList.add(pay);
                 }
             }