|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
4
|
4
|
import com.alibaba.fastjson.JSONArray;
|
5
|
5
|
import com.xhkjedu.smarking.config.ConfigKey;
|
6
|
6
|
import com.xhkjedu.smarking.vo.paper.PaperFileVo;
|
|
7
|
+import com.xhkjedu.smarking.vo.report.reportother.RankGroupVo;
|
7
|
8
|
import com.xhkjedu.utils.N_Utils;
|
8
|
9
|
import com.xhkjedu.vo.ResultVo;
|
9
|
10
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -34,7 +35,6 @@ public class MarkingUtil {
|
34
|
35
|
|
35
|
36
|
/**
|
36
|
37
|
* 删除Html标签
|
37
|
|
- *
|
38
|
38
|
*/
|
39
|
39
|
public static String htmlRemoveTag(String inputString) {
|
40
|
40
|
if (inputString == null)
|
|
@@ -48,9 +48,9 @@ public class MarkingUtil {
|
48
|
48
|
java.util.regex.Pattern p_html;
|
49
|
49
|
java.util.regex.Matcher m_html;
|
50
|
50
|
try {
|
51
|
|
- //定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
|
|
51
|
+ // 定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
|
52
|
52
|
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
|
53
|
|
- //定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
|
|
53
|
+ // 定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
|
54
|
54
|
String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
|
55
|
55
|
String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
|
56
|
56
|
p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
|
|
@@ -76,17 +76,17 @@ public class MarkingUtil {
|
76
|
76
|
* @Param [str1, str2]
|
77
|
77
|
* @Return int
|
78
|
78
|
**/
|
79
|
|
- public static int isEqualStringCheck(String str1,String str2){
|
|
79
|
+ public static int isEqualStringCheck(String str1, String str2) {
|
80
|
80
|
char[] charArray1 = str1.toCharArray();
|
81
|
81
|
char[] charArray2 = str2.toCharArray();
|
82
|
82
|
Arrays.sort(charArray1);
|
83
|
83
|
Arrays.sort(charArray2);
|
84
|
|
- int eqResult = 0;//0代表不相等 1表示两个字符串相等 2代表字符串1包含字符串2
|
85
|
|
- if(Arrays.equals(charArray1, charArray2)){
|
|
84
|
+ int eqResult = 0;// 0代表不相等 1表示两个字符串相等 2代表字符串1包含字符串2
|
|
85
|
+ if (Arrays.equals(charArray1, charArray2)) {
|
86
|
86
|
eqResult = 1;
|
87
|
87
|
}
|
88
|
88
|
|
89
|
|
- if(Collections.singletonList(charArray1).contains(charArray2)){
|
|
89
|
+ if (Collections.singletonList(charArray1).contains(charArray2)) {
|
90
|
90
|
eqResult = 2;
|
91
|
91
|
}
|
92
|
92
|
|
|
@@ -100,21 +100,21 @@ public class MarkingUtil {
|
100
|
100
|
* @Param [stuanswer, q]
|
101
|
101
|
* @Return java.lang.Double
|
102
|
102
|
**/
|
103
|
|
- public static Double checkObjectiveStuAnswer(String stuanswer, int ctype,String qanswer,Double loseoption,Double qscore){
|
104
|
|
- String qanswerCort = JSON.parseArray(qanswer, String.class).get(0);//试题正确答案
|
|
103
|
+ public static Double checkObjectiveStuAnswer(String stuanswer, int ctype, String qanswer, Double loseoption, Double qscore) {
|
|
104
|
+ String qanswerCort = JSON.parseArray(qanswer, String.class).get(0);// 试题正确答案
|
105
|
105
|
Double stuscore = 0D;
|
106
|
|
- if(N_Utils.isNotEmpty(stuanswer)){
|
107
|
|
- if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
|
108
|
|
- if(qanswerCort.equalsIgnoreCase(stuanswer)){
|
|
106
|
+ if (N_Utils.isNotEmpty(stuanswer)) {
|
|
107
|
+ if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
|
|
108
|
+ if (qanswerCort.equalsIgnoreCase(stuanswer)) {
|
109
|
109
|
stuscore = qscore;
|
110
|
110
|
}
|
111
|
|
- }else if(ctype == 2){
|
112
|
|
- //多选题进行判断,
|
|
111
|
+ } else if (ctype == 2) {
|
|
112
|
+ // 多选题进行判断,
|
113
|
113
|
int isEqualStr = isEqualStringCheck(qanswerCort, stuanswer);
|
114
|
|
- if(isEqualStr == 1){
|
|
114
|
+ if (isEqualStr == 1) {
|
115
|
115
|
stuscore = qscore;
|
116
|
|
- }else if(isEqualStr == 2){
|
117
|
|
- stuscore = loseoption;//少选得分
|
|
116
|
+ } else if (isEqualStr == 2) {
|
|
117
|
+ stuscore = loseoption;// 少选得分
|
118
|
118
|
}
|
119
|
119
|
}
|
120
|
120
|
}
|
|
@@ -135,7 +135,7 @@ public class MarkingUtil {
|
135
|
135
|
return b1.add(b2).doubleValue();
|
136
|
136
|
}
|
137
|
137
|
|
138
|
|
- //两数相减
|
|
138
|
+ // 两数相减
|
139
|
139
|
public static long subtract(long a, long b) {
|
140
|
140
|
BigInteger biginta = new BigInteger(a + "");
|
141
|
141
|
BigInteger bigintb = new BigInteger(b + "");
|
|
@@ -143,7 +143,7 @@ public class MarkingUtil {
|
143
|
143
|
|
144
|
144
|
}
|
145
|
145
|
|
146
|
|
- //两数相减
|
|
146
|
+ // 两数相减
|
147
|
147
|
public static Integer subtractInt(Integer a, Integer b) {
|
148
|
148
|
BigInteger biginta = new BigInteger(a + "");
|
149
|
149
|
BigInteger bigintb = new BigInteger(b + "");
|
|
@@ -166,6 +166,7 @@ public class MarkingUtil {
|
166
|
166
|
|
167
|
167
|
/**
|
168
|
168
|
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后2位,以后的数字舍弃。
|
|
169
|
+ *
|
169
|
170
|
* @param v1 被除数
|
170
|
171
|
* @param v2 除数
|
171
|
172
|
* @return 两个参数的商
|
|
@@ -189,7 +190,8 @@ public class MarkingUtil {
|
189
|
190
|
|
190
|
191
|
/**
|
191
|
192
|
* 向上取值
|
192
|
|
- * @param score 原始得分
|
|
193
|
+ *
|
|
194
|
+ * @param score 原始得分
|
193
|
195
|
* @param interval 取值间隔
|
194
|
196
|
* @return 向上取值后的结果
|
195
|
197
|
*/
|
|
@@ -199,7 +201,8 @@ public class MarkingUtil {
|
199
|
201
|
|
200
|
202
|
/**
|
201
|
203
|
* 向下取值
|
202
|
|
- * @param score 原始得分
|
|
204
|
+ *
|
|
205
|
+ * @param score 原始得分
|
203
|
206
|
* @param interval 取值间隔
|
204
|
207
|
* @return 向下取值后的结果
|
205
|
208
|
*/
|
|
@@ -209,7 +212,8 @@ public class MarkingUtil {
|
209
|
212
|
|
210
|
213
|
/**
|
211
|
214
|
* 计算总分并处理超过满分的情况
|
212
|
|
- * @param scores 得分数组
|
|
215
|
+ *
|
|
216
|
+ * @param scores 得分数组
|
213
|
217
|
* @param interval 取值间隔
|
214
|
218
|
* @param maxScore 满分
|
215
|
219
|
* @return 最终总分
|
|
@@ -226,6 +230,7 @@ public class MarkingUtil {
|
226
|
230
|
|
227
|
231
|
/**
|
228
|
232
|
* 计算两个分数之间的分差
|
|
233
|
+ *
|
229
|
234
|
* @param score1 第一个分数
|
230
|
235
|
* @param score2 第二个分数
|
231
|
236
|
* @return 分差
|
|
@@ -248,7 +253,7 @@ public class MarkingUtil {
|
248
|
253
|
return b1.subtract(b2).doubleValue();
|
249
|
254
|
}
|
250
|
255
|
|
251
|
|
- //字符串转为时间戳(秒)
|
|
256
|
+ // 字符串转为时间戳(秒)
|
252
|
257
|
public static long strToTimestamp(String str) {
|
253
|
258
|
if (str == null || str.isEmpty()) return 0;
|
254
|
259
|
DateTimeFormatter ftf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
@@ -263,15 +268,15 @@ public class MarkingUtil {
|
263
|
268
|
* @Author wn
|
264
|
269
|
* @Date 2022/10/27 11:36
|
265
|
270
|
**/
|
266
|
|
- public static long getTimestrToTimetamp(String time){
|
|
271
|
+ public static long getTimestrToTimetamp(String time) {
|
267
|
272
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
268
|
273
|
Date date = new Date();
|
269
|
274
|
try {
|
270
|
275
|
date = sdf.parse(time);
|
271
|
|
- }catch (Exception e){
|
|
276
|
+ } catch (Exception e) {
|
272
|
277
|
log.error("字符串转时间戳出错:" + e.getMessage());
|
273
|
278
|
}
|
274
|
|
- return date.getTime()/1000;
|
|
279
|
+ return date.getTime() / 1000;
|
275
|
280
|
}
|
276
|
281
|
|
277
|
282
|
/*
|
|
@@ -281,32 +286,32 @@ public class MarkingUtil {
|
281
|
286
|
* @Param [stupic, merged, saveFloder]
|
282
|
287
|
* @Return java.lang.String
|
283
|
288
|
**/
|
284
|
|
- public static String uploadBase64Img(String stupic,Integer merged,String saveFloder) {
|
|
289
|
+ public static String uploadBase64Img(String stupic, Integer merged, String saveFloder) {
|
285
|
290
|
String apiMethod;
|
286
|
|
- if(merged == 1){
|
287
|
|
- //说明上传的图片为单张保存
|
|
291
|
+ if (merged == 1) {
|
|
292
|
+ // 说明上传的图片为单张保存
|
288
|
293
|
apiMethod = "bs/base";
|
289
|
|
- }else{
|
290
|
|
- //上传的多张图片需要合并为一张
|
|
294
|
+ } else {
|
|
295
|
+ // 上传的多张图片需要合并为一张
|
291
|
296
|
apiMethod = "bs/mbase_merge";
|
292
|
297
|
}
|
293
|
|
- String stubase64;//防止内容被更改
|
|
298
|
+ String stubase64;// 防止内容被更改
|
294
|
299
|
try {
|
295
|
300
|
stubase64 = URLEncoder.encode(stupic, "UTF-8");
|
296
|
301
|
} catch (UnsupportedEncodingException e) {
|
297
|
302
|
log.error("base64格式化内容出错" + e.getMessage());
|
298
|
303
|
throw new RuntimeException(e);
|
299
|
304
|
}
|
300
|
|
- //处理字段那种图片路径,base64转图片
|
|
305
|
+ // 处理字段那种图片路径,base64转图片
|
301
|
306
|
String params = "base64path=" + stubase64 + "&savefolder=" + saveFloder;
|
302
|
307
|
String fileInfoStr = N_Utils.sendPost(ConfigKey.fileapi + apiMethod, params);
|
303
|
|
- if(N_Utils.isEmpty(fileInfoStr)){
|
|
308
|
+ if (N_Utils.isEmpty(fileInfoStr)) {
|
304
|
309
|
return "";
|
305
|
310
|
}
|
306
|
311
|
ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
|
307
|
312
|
if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
|
308
|
313
|
return fileResult.getObj().toString();
|
309
|
|
- }else{
|
|
314
|
+ } else {
|
310
|
315
|
return "";
|
311
|
316
|
}
|
312
|
317
|
}
|
|
@@ -318,8 +323,8 @@ public class MarkingUtil {
|
318
|
323
|
* @Param [stupic, saveFloder]
|
319
|
324
|
* @Return java.util.List<java.lang.String>
|
320
|
325
|
**/
|
321
|
|
- public static PaperFileVo uploadBatchBase64ImgPdf(List<String> imgList, String saveFloder){
|
322
|
|
- //处理字段那种图片路径,base64转图片
|
|
326
|
+ public static PaperFileVo uploadBatchBase64ImgPdf(List<String> imgList, String saveFloder) {
|
|
327
|
+ // 处理字段那种图片路径,base64转图片
|
323
|
328
|
String base64path = JSON.toJSONString(imgList);
|
324
|
329
|
try {
|
325
|
330
|
base64path = URLEncoder.encode(base64path, "UTF-8");
|
|
@@ -333,7 +338,7 @@ public class MarkingUtil {
|
333
|
338
|
ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
|
334
|
339
|
if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
|
335
|
340
|
return JSONArray.parseObject(fileResult.getObj().toString(), PaperFileVo.class);
|
336
|
|
- }else{
|
|
341
|
+ } else {
|
337
|
342
|
return null;
|
338
|
343
|
}
|
339
|
344
|
}
|
|
@@ -351,12 +356,12 @@ public class MarkingUtil {
|
351
|
356
|
Matcher matcher = pattern.matcher(input);
|
352
|
357
|
|
353
|
358
|
while (matcher.find()) {
|
354
|
|
- if (matcher.group(1)!= null) {
|
|
359
|
+ if (matcher.group(1) != null) {
|
355
|
360
|
result.add(matcher.group(1));
|
356
|
|
- } else if (matcher.group(2)!= null) {
|
|
361
|
+ } else if (matcher.group(2) != null) {
|
357
|
362
|
String str = matcher.group(2);
|
358
|
|
- for(char c : str.toCharArray()){
|
359
|
|
- result.add(c+"");
|
|
363
|
+ for (char c : str.toCharArray()) {
|
|
364
|
+ result.add(c + "");
|
360
|
365
|
}
|
361
|
366
|
}
|
362
|
367
|
}
|
|
@@ -364,44 +369,44 @@ public class MarkingUtil {
|
364
|
369
|
return result;
|
365
|
370
|
}
|
366
|
371
|
|
367
|
|
- public static String[] qnArr = {"一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十",
|
368
|
|
- "二十一","二十二","二十三","二十四","二十五","二十六","二十七","二十八","二十九","三十"};
|
|
372
|
+ public static String[] qnArr = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十",
|
|
373
|
+ "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十"};
|
369
|
374
|
|
370
|
|
- //获取题号
|
371
|
|
- public static String getQnByOrder(Integer qorder){
|
|
375
|
+ // 获取题号
|
|
376
|
+ public static String getQnByOrder(Integer qorder) {
|
372
|
377
|
String rtnStr;
|
373
|
|
- if(qorder == null || qorder == 0 || qorder > 30){
|
|
378
|
+ if (qorder == null || qorder == 0 || qorder > 30) {
|
374
|
379
|
rtnStr = qnArr[0];
|
375
|
380
|
}
|
376
|
|
- rtnStr = qnArr[qorder-1];
|
|
381
|
+ rtnStr = qnArr[qorder - 1];
|
377
|
382
|
return rtnStr;
|
378
|
383
|
}
|
379
|
384
|
|
380
|
|
- //方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
|
|
385
|
+ // 方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
|
381
|
386
|
public static double fc(List<Double> x) {
|
382
|
387
|
if (N_Utils.isListEmpty(x)) return 0;
|
383
|
388
|
int m = x.size();
|
384
|
389
|
double sum = 0;
|
385
|
|
- for (int i = 0; i < m; i++) {//求和
|
|
390
|
+ for (int i = 0; i < m; i++) {// 求和
|
386
|
391
|
sum += x.get(i);
|
387
|
392
|
}
|
388
|
|
- double dAve = sum / m;//求平均值
|
|
393
|
+ double dAve = sum / m;// 求平均值
|
389
|
394
|
double dVar = 0;
|
390
|
|
- for (int i = 0; i < m; i++) {//求方差
|
|
395
|
+ for (int i = 0; i < m; i++) {// 求方差
|
391
|
396
|
dVar += (x.get(i) - dAve) * (x.get(i) - dAve);
|
392
|
397
|
}
|
393
|
398
|
return dVar / m;
|
394
|
399
|
}
|
395
|
400
|
|
396
|
|
- //标准差σ=sqrt(s^2)
|
|
401
|
+ // 标准差σ=sqrt(s^2)
|
397
|
402
|
public static double bzc(List<Double> x) {
|
398
|
403
|
if (N_Utils.isListEmpty(x)) return 0;
|
399
|
404
|
return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
|
400
|
405
|
}
|
401
|
406
|
|
402
|
407
|
|
403
|
|
- //中位数
|
404
|
|
- public static double zws(List<Double> list){
|
|
408
|
+ // 中位数
|
|
409
|
+ public static double zws(List<Double> list) {
|
405
|
410
|
if (N_Utils.isListEmpty(list)) return 0;
|
406
|
411
|
// 先对列表进行排序
|
407
|
412
|
List<Double> sorteList = list.stream().sorted().collect(Collectors.toList());
|
|
@@ -418,7 +423,7 @@ public class MarkingUtil {
|
418
|
423
|
}
|
419
|
424
|
}
|
420
|
425
|
|
421
|
|
- //区分度=2×(高分组平均分-低分组平均分)/100
|
|
426
|
+ // 区分度=2×(高分组平均分-低分组平均分)/100
|
422
|
427
|
public static double qfd(List<Double> scores) {
|
423
|
428
|
if (N_Utils.isListEmpty(scores)) return 0;
|
424
|
429
|
|
|
@@ -434,7 +439,7 @@ public class MarkingUtil {
|
434
|
439
|
return div(mul(2, sub(highGroupAvg, lowGroupAvg)), 100);
|
435
|
440
|
}
|
436
|
441
|
|
437
|
|
- //计算平均分
|
|
442
|
+ // 计算平均分
|
438
|
443
|
public static double calculateAverage(List<Double> scores) {
|
439
|
444
|
if (N_Utils.isListEmpty(scores)) return 0;
|
440
|
445
|
double sum = 0.0;
|
|
@@ -444,14 +449,23 @@ public class MarkingUtil {
|
444
|
449
|
return div(sum, scores.size());
|
445
|
450
|
}
|
446
|
451
|
|
447
|
|
- //众数
|
448
|
|
- public static List<Double> zs(List<Double> list){
|
|
452
|
+ //计算占比
|
|
453
|
+ public static double calculateRate(Object v1,Object v2){
|
|
454
|
+ BigDecimal b1 = new BigDecimal(v1.toString());
|
|
455
|
+ BigDecimal b2 = new BigDecimal(v2.toString());
|
|
456
|
+
|
|
457
|
+ BigDecimal b3 = b1.divide(b2, 4, BigDecimal.ROUND_DOWN);
|
|
458
|
+ return b3.multiply(new BigDecimal("100")).doubleValue();
|
|
459
|
+ }
|
|
460
|
+
|
|
461
|
+ // 众数
|
|
462
|
+ public static List<Double> zs(List<Double> list) {
|
449
|
463
|
List<Double> modes = new ArrayList<>();
|
450
|
464
|
if (N_Utils.isListEmpty(list)) return modes;
|
451
|
465
|
|
452
|
466
|
// 使用HashMap来统计每个元素出现的次数
|
453
|
467
|
Map<Double, Long> countMap = list.stream()
|
454
|
|
- .collect(Collectors.groupingBy(e -> e, Collectors.counting()));
|
|
468
|
+ .collect(Collectors.groupingBy(e -> e, Collectors.counting()));
|
455
|
469
|
|
456
|
470
|
long maxCount = 0;
|
457
|
471
|
// 找出最大的出现次数
|
|
@@ -468,22 +482,22 @@ public class MarkingUtil {
|
468
|
482
|
return modes;
|
469
|
483
|
}
|
470
|
484
|
|
471
|
|
- //超均率 =(个人单科得分-全校平均分)÷全校平均分
|
472
|
|
- public static double cjl(Object v1,Object v2){
|
473
|
|
- if(v2 == null || "0".equals(v2)) return 0;
|
|
485
|
+ // 超均率 =(个人单科得分-全校平均分)÷全校平均分
|
|
486
|
+ public static double cjl(Object v1, Object v2) {
|
|
487
|
+ if (v2 == null || "0".equals(v2)) return 0;
|
474
|
488
|
|
475
|
489
|
BigDecimal b1 = new BigDecimal(v1.toString());
|
476
|
490
|
BigDecimal b2 = new BigDecimal(v2.toString());
|
477
|
491
|
return b1.subtract(b2).divide(b2, 2, BigDecimal.ROUND_DOWN).doubleValue();
|
478
|
492
|
}
|
479
|
493
|
|
480
|
|
- //标准分 班级标准分 =(班级得分-全校平均分)÷年级标准差
|
|
494
|
+ // 标准分 班级标准分 =(班级得分-全校平均分)÷年级标准差
|
481
|
495
|
public static double bzf(Double score, Double avgscore, Double bzc) {
|
482
|
496
|
double bzscore = div(sub(score, avgscore), bzc);
|
483
|
497
|
return N_Utils.formatDouble(bzscore, 2);
|
484
|
498
|
}
|
485
|
499
|
|
486
|
|
- //综合率 固定计算=平均得分率*50%+优秀率*25%+及格率*25%
|
|
500
|
+ // 综合率 固定计算=平均得分率*50%+优秀率*25%+及格率*25%
|
487
|
501
|
public static double zhl(Double v1, Double v2, Double v3) {
|
488
|
502
|
double s1 = mul(v1, 0.5);
|
489
|
503
|
double s2 = mul(v2, 0.25);
|
|
@@ -491,41 +505,64 @@ public class MarkingUtil {
|
491
|
505
|
return add(s1, add(s2, s3));
|
492
|
506
|
}
|
493
|
507
|
|
494
|
|
- //学科上线贡献率 班级学科上线贡献率=(班级学科上线率-班级总分上线率)-(学校学科的上线率-学校总分上线率)
|
495
|
|
- public static double sxgxl(Double v1,Double v2,Double v3,Double v4){
|
496
|
|
- double s1 = sub(v1,v2);
|
497
|
|
- double s2 = sub(v3,v4);
|
498
|
|
- return sub(s1,s2);
|
|
508
|
+ // 学科上线贡献率 班级学科上线贡献率=(班级学科上线率-班级总分上线率)-(学校学科的上线率-学校总分上线率)
|
|
509
|
+ public static double sxgxl(Double v1, Double v2, Double v3, Double v4) {
|
|
510
|
+ double s1 = sub(v1, v2);
|
|
511
|
+ double s2 = sub(v3, v4);
|
|
512
|
+ return sub(s1, s2);
|
499
|
513
|
}
|
500
|
514
|
|
501
|
|
- //短板学生 学科短板学生:偏科指数=(单科分值-全科平均分)÷全科标准差 ,如果偏科指数>1,标识此科为短板学科
|
502
|
|
- public static double dbxs(Double v1,Double v2,Double v3){
|
503
|
|
- return div(sub(v1,v2),v3);
|
|
515
|
+ // 短板学生 学科短板学生:偏科指数=(单科分值-全科平均分)÷全科标准差 ,如果偏科指数>1,标识此科为短板学科
|
|
516
|
+ public static double dbxs(Double v1, Double v2, Double v3) {
|
|
517
|
+ return div(sub(v1, v2), v3);
|
504
|
518
|
}
|
505
|
519
|
|
506
|
|
- //鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
|
507
|
|
- //将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
|
508
|
|
- public static double jbzs(List<Double> list,Double qscore){
|
|
520
|
+ // 鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
|
|
521
|
+ // 将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
|
|
522
|
+ public static double jbzs(List<Double> list, Double scoreRate) {
|
509
|
523
|
List<Double> sortList = list.stream().sorted().collect(Collectors.toList());
|
510
|
524
|
int size = sortList.size();
|
511
|
|
- int count = (int)(size * 0.27);//27%学生数量
|
|
525
|
+ int count = (int) (size * 0.27);// 27%学生数量
|
512
|
526
|
|
513
|
527
|
// 前27%的学生
|
514
|
528
|
List<Double> topGroup = sortList.subList(0, count);
|
515
|
529
|
double topScore = topGroup.stream().mapToDouble(Double::doubleValue).sum();
|
516
|
|
- double topRate = div(topScore, mul(qscore, count));
|
|
530
|
+ double topRate = div(topScore, mul(scoreRate, count));
|
517
|
531
|
|
518
|
532
|
// 后27%的学生
|
519
|
533
|
List<Double> bottomGroup = sortList.subList(size - count, size);
|
520
|
534
|
double bottomScore = bottomGroup.stream().mapToDouble(Double::doubleValue).sum();
|
521
|
|
- double bottomRate = div(bottomScore, mul(qscore, count));
|
|
535
|
+ double bottomRate = div(bottomScore, mul(scoreRate, count));
|
522
|
536
|
|
523
|
537
|
// 鉴别指数
|
524
|
538
|
return sub(topRate, bottomRate);
|
525
|
539
|
}
|
526
|
540
|
|
|
541
|
+ //排名分组计算 用于第一组(第1-10名)
|
|
542
|
+ public static List<RankGroupVo> rankGroup(Integer total) {
|
|
543
|
+ List<RankGroupVo> rtnList = new ArrayList<>();
|
|
544
|
+
|
|
545
|
+ int count = total / 10;
|
|
546
|
+ for (int i = 0; i < count; i++) {
|
|
547
|
+ RankGroupVo rg = new RankGroupVo();
|
|
548
|
+ rg.setMaxvalue((i + 1) * 10);
|
|
549
|
+ rg.setMinvalue(i * 10 + 1);
|
|
550
|
+ rtnList.add(rg);
|
|
551
|
+ }
|
|
552
|
+
|
|
553
|
+ if (total % 10 > 0) {
|
|
554
|
+ //未被整除,添加最后一组
|
|
555
|
+ RankGroupVo rg = new RankGroupVo();
|
|
556
|
+ rg.setMaxvalue(total);
|
|
557
|
+ rg.setMinvalue(count * 10 + 1);
|
|
558
|
+ rtnList.add(rg);
|
|
559
|
+ }
|
|
560
|
+ return rtnList;
|
|
561
|
+ }
|
|
562
|
+
|
527
|
563
|
public static void main(String[] args) {
|
528
|
|
- System.out.println(cjl(50,40));
|
|
564
|
+ System.out.println(cjl(50, 40));
|
|
565
|
+
|
529
|
566
|
}
|
530
|
567
|
|
531
|
568
|
|