Browse Source

计算两个时间戳相差的天数完善

区域作业/预习人均用时完善
教师统计-作业概况-作业详情完善
tags/正式3.13.0
雍文秀 1 year ago
parent
commit
ce7e238341

+ 2
- 2
sapi/src/main/java/com/xhkjedu/sapi/service/region/RPaperAnalyzeService.java View File

@@ -261,7 +261,7 @@ public class RPaperAnalyzeService {
261 261
                 Integer usetimes = Integer.parseInt(map.get("costtime").toString());
262 262
                 Integer stunum = Integer.parseInt(map.get("stunum").toString());
263 263
 
264
-                double avgtime = N_Utils.formatAvg(day * stunum,usetimes);
264
+                double avgtime = N_Utils.formatAvg(usetimes, day * stunum);
265 265
                 map.put("avgtime",avgtime);
266 266
             }
267 267
         }
@@ -280,7 +280,7 @@ public class RPaperAnalyzeService {
280 280
                 Integer usetimes = Integer.parseInt(map.get("costtime").toString());
281 281
                 Integer stunum = Integer.parseInt(map.get("stunum").toString());
282 282
 
283
-                double avgtime = N_Utils.formatAvg(day * stunum,usetimes);
283
+                double avgtime = N_Utils.formatAvg(usetimes, day * stunum);
284 284
                 map.put("avgtime",avgtime);
285 285
             }
286 286
         }

+ 1
- 1
sapi/src/main/resources/mapper/analyze/SchoolTaskMapper.xml View File

@@ -46,7 +46,7 @@
46 46
         left join t_paper_student ps1 on ps1.paperid=pg.paperid and ps1.classid=pg.classid
47 47
         left join t_class c on c.classid=pg.classid
48 48
         left join t_director d on p.directorid=d.directorid
49
-        where d.deleted=0 and p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
49
+        where p.deleted=0 and p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
50 50
         and c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year} and (d.disabled=0 or p.directorid is null)
51 51
         <if test="sparams.starttime!=null and sparams.starttime!=0">
52 52
             AND pg.starttime>=#{sparams.starttime}

+ 8
- 3
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java View File

@@ -124,12 +124,17 @@ public class N_Utils {
124 124
     //计算两个时间戳相差的天数
125 125
     public static Integer getTimestampDay(Integer begintime,Integer endtime){
126 126
         if(isEmptyInteger(begintime)) return 365;//默认时间差为一年
127
-        Integer day = 0;
127
+        /*Integer day = 0;
128 128
 
129 129
         Integer cha = endtime - begintime;
130
-        day = cha / (3600 * 24);
131 130
 
132
-        return day;
131
+        day = cha / (3600 * 24);*/
132
+
133
+        BigDecimal b1 = new BigDecimal(String.valueOf(endtime - begintime));
134
+        BigDecimal b2 = new BigDecimal(String.valueOf(3600 * 24));
135
+
136
+        BigDecimal count = b1.divide(b2,2,BigDecimal.ROUND_UP);
137
+        return count.intValue();
133 138
     }
134 139
 
135 140
     /**

Loading…
Cancel
Save