qF9@#Tq)ZNS ;Q)*53751Fb#lP3qoar6fS_>0`$ z9Y1V2x5<;+`3X3Y^?c6(o}=NC@_E9;ARvW@Fu%bcue19^)dD3<26KT5a}Zcn4CUhO zHaMfA$liREaYM&YM{P>($9ce3($R0s6q4`w1i!0N8|%5?H-FGgaDASPEGTWzev?mC z6x@X009r 5Q7h_VZbgxh19 z{n*1}V)xraCF$cB{433S?C>#9`t7iq?3cqwEa_ia(_^Q9Cjh@)0stK30Kh-!z+>~j iSMI->*HZq){LebBssIPcK>z?1@}q;KaTv|dtN#OLvzuiA literal 0 HcmV?d00001 diff --git a/src/main/resources/excel-template/试题导出模板.xlsx b/src/main/resources/excel-template/试题导出模板.xlsx index cc6ed7d7d57aa329727f0b788025b459815a375e..46366b90c68ea24c44fd77ced73871d8006e07fc 100644 GIT binary patch delta 3823 zcmZ9PXH*ji630WYLg<|kq(&(UgkB9bw50~5cTA`vMZ`$&HMAu(=^Ydh2@pY~3kafg z2!^JBf;0tzTlenW-n;oWZ)QHt{N_KCXgOrsvOtNZK?TCjNC5yMB>=z(002T!QXzhU zNEbgpq-3ZMs=;#A4=W9PT+(($a$wv?uBRbvSpc%F@JU)|ib%9j9Hg-V$SlfQSYDkL zfrWfp yN2<{gu9m?l+0N(MIcvhv)`jrs(u%C1vs zwI8C{rjgbDC#t+i4D1%7d$c>!cQ}p#(=#MVsAf>Ol5Hq)6MNFY@NwMnr zm|V0zzt=J(PQ}DyeH1c49=k$9qp2Y6!n~Ga=aj>pGwgDoS>i#-2r~<=P?U8w^1(8q z(=hlHk_Q(bHaneSE)5l?&Vk#q6xbwf3I|cz<4qxIKFR2J5D_IyXhrq4r#)yaBmo91 z;^#2n^j9x=6klLRq^bdK3!vxa_jwJTJUpdfV#1+mUu({R!pV@bbh^1)F?crPLA;!f zYPI@dbl+S^F_@DH7DF_sJpY8;o;&*W>g8hs?odFq4iQ*!u)Zq=pY)5HIBg*NxVR)y zt{j$~2u(dpW20I1W(xz(xOxhjAR}fKz9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FOoo5f?k)GzQTGbnXQ zW+#J->thH-ZnK-_F3#_D(Yce~fn^pTIQ*~;BelHSUWkJesN<7;tu^-WrAmI3ZpOTz z5YTA>-Rb(=t#C_P TG;&8$lrFT)@9os6ix4xZuxN8*3l+Yn8Vf>I5OlFnb=g03^dT;r zd{eRj$E|Y1VN=5oFA}6MjB3SB*O$d+hH{23K0ULY-94|exs6+(S{rZAwylmJ0*kF| z^pR?36uEwDzZjcSq1l7vIJZ#Oy!n(=X<@{A$T+94^U|SGdjG}tU-vh`9>-XWH^l!a zb~h6?4z9Xnb6>+Cix?LC c27mHjOQeY^!`+{4O;!okroZrjd zg2U-i6(pTqCZ?54$=oVf+!n;;Z>0RcSM^8{RoQ6N)*HPm<}hjGudWfP=BXi-&3X~$ zN#TM~AJMD!ZuEuf#|x||_PcC68i`w6Fc`fmowpkMMX-nkUGs~C^Lc0q4SEohoXaV3 zeZb)8!L#ad9wZiq6Qwr1SHivbd-Q(fZhn%7!+~>I_jfMTbI_$bz|(`JiYXp4tpr)< zKfWRie)(M1r!rEn3AGjytK~65DrB79bGX?SPLiZ?aHV0tyzt7OPkxChE`S>?-TMVE zX*cCk78p9A@O#5Sc9XNCW3fsnxzCnipg}0lZ73%N55nbsuoQPEZuY7SI(^Rx_N1HW zwQXh#htj;xN{n`po7(KWA?ug;&lRQ4u7yMR-yZ`qj}wY}NC*HR$%z<{L|`D}e-Erb z=7{bOyZ#$&$R}WBtT1E%7|i&;7V6(FNn|^imFa&u`rrCJ1M(MG4*Q%LIl;t list = new ArrayList<>(); + list.add("a"); + list.add("b"); + list.add("c"); + list.add("d"); + list.add("b"); + list.add("c"); + list.add("a"); + list.add("a"); + list.add("a"); + + System.out.println("\n例子1 - 计算'a'出现的次数"); + System.out.println("a : " + Collections.frequency(list, "a")); + + System.out.println("\n例子2 - 计算所有对象出现的次数"); + Set uniqueSet = new HashSet<>(list); + for (String temp : uniqueSet) { + System.out.println(temp + ": " + Collections.frequency(list, temp)); + } + + System.out.println("\n例子3 -用Map来计算对象出现的次数"); + Map map = new HashMap<>(); + + for (String temp : list) { + Integer count = map.get(temp); + map.put(temp, (count == null) ? 1 : count + 1); + } + printMap(map); + + System.out.println("\nMap排序-以key排序"); + Map treeMap = new TreeMap<>(map); + printMap(treeMap); + + } + + static void printMap(Map map) { + for (Map.Entry entry : map.entrySet()) { + System.out.println("Key-value : " + entry.getKey() + "- " + + entry.getValue()); + } + } + + + @Test + void t9() throws Exception { + + List list = new ArrayList<>(); + list.add(new UserTest(1, "张三", "男", "深圳", "123456")); + list.add(new UserTest(2, "李四", "男", "深圳", "123456")); + list.add(new UserTest(3, "张三", "男", "杭州", "123456")); + list.add(new UserTest(4, "张三", "男", "深圳", "123456")); + list.add(new UserTest(5, "王五", "男", "深圳", "123456")); + list.add(new UserTest(6, "张三", "男", "深圳", "123456")); + list.add(new UserTest(7, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(8, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(9, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(10, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(11, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(12, "张三", "男", "菲律宾", "123456")); + list.add(new UserTest(13, "张三", "男", "深圳", "123456")); + list.add(new UserTest(14, "张三", "男", "马来西亚", "123456")); + + + List errorMsg = new ArrayList<>(); + + ArrayList collect = list.stream() + .collect(Collectors.collectingAndThen(// 去重收集 + Collectors.toCollection(() -> + new TreeSet<>(Comparator.comparing(UserTest::toString))), + ArrayList::new + )); + + for (UserTest userTest : collect) { + + System.out.println(userTest.getIndex() + "-----" + userTest.toString()); + } + + System.out.println("----------------------------"); + + List userTests = removeRepeatFactor3(collect, list); + + for (UserTest userTest : userTests) { + + System.out.println(userTest.getIndex() + "-----" + userTest.toString()); + } + + + } + + private List removeRepeatFactor(List list1, List list2) { + if (list1 != null && list2 != null) { + if (list1.size() != 0 && list2.size() != 0) { + Collection A = new ArrayList<>(list1); + List B = new ArrayList<>(list2); + A.retainAll(B); + if (A.size() != 0) { + B.removeAll(A); + } + return B; + } + } + return list2; + } + + private List removeRepeatFactor3(List list1, List list2) { + if (list1 != null && list2 != null) { + if (list1.size() != 0 && list2.size() != 0) { + Collection A = new ArrayList<>(list1); + List B = new ArrayList<>(list2); + A.retainAll(B); + if (A.size() != 0) { + B.removeAll(A); + } + return B; + } + } + return list2; + } + + public List removeRepeatFactor2(List list1, List list2) throws Exception { + if (list1 != null && list2 != null) { + if (list1.size() != 0 && list2.size() != 0) { + Collection A = new ArrayList<>(list1); + Collection B = new ArrayList<>(list2); + A.retainAll(B); + if (A.size() != 0) { + B.removeAll(A); + } + return (List ) B; + } + } + return list2; + } + + + @Test + void t10() { + + QuestionsImportRequest questionsImportRequest = new QuestionsImportRequest(); + questionsImportRequest.setOptionA("aaa"); + questionsImportRequest.setOptionB("bbb"); + questionsImportRequest.setOptionC("ccc"); + questionsImportRequest.setOptionD("ddd"); + questionsImportRequest.setOptionE("eee"); + questionsImportRequest.setOptionF("fff"); + questionsImportRequest.setQuestionStem("stem"); + questionsImportRequest.setQuestionTypeName("type"); + + System.out.println(questionsImportRequest.toStringForCompare()); + + } + + @Test + void t11() { + + List list = new ArrayList<>(); + list.add(new UserTest(1, "张三", "男", "深圳", "123456")); + list.add(new UserTest(2, "李四", "男", "深圳", "123456")); + list.add(new UserTest(3, "张三", "男", "杭州", "123456")); + list.add(new UserTest(4, "张三", "男", "深圳", "123456")); + list.add(new UserTest(5, "王五", "男", "深圳", "123456")); + list.add(new UserTest(6, "张三", "男", "深圳", "123456")); + list.add(new UserTest(7, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(8, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(9, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(10, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(11, "赵六", "女", "深圳", "123456")); + list.add(new UserTest(12, "张三", "男", "菲律宾", "123456")); + list.add(new UserTest(13, "张三", "男", "深圳", "123456")); + list.add(new UserTest(14, "张三", "男", "马来西亚", "123456")); + + stringRedisTemplate.opsForList().leftPush("sss", list.toString()); + } + } diff --git a/src/test/java/com/msdw/tms/UserTest.java b/src/test/java/com/msdw/tms/UserTest.java new file mode 100644 index 0000000..84e2982 --- /dev/null +++ b/src/test/java/com/msdw/tms/UserTest.java @@ -0,0 +1,26 @@ +package com.msdw.tms; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UserTest { + private int index; + private String name; + private String gender; + private String addr; + private String phone; + + @Override + public String toString() { + return "UserTest{" + + "name='" + name + '\'' + + ", gender='" + gender + '\'' + + ", addr='" + addr + '\'' + + ", phone='" + phone + '\'' + + '}'; + } +} diff --git a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java index 062824a..31729c3 100644 --- a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java +++ b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 记录试题信息 @@ -93,9 +94,9 @@ class QuestionsServiceTest { IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); MultipartFile multipartFile = new CommonsMultipartFile(fileItem); - List strings = questionsService.importQuestion(multipartFile); + Map map = questionsService.importQuestion(multipartFile); - System.out.println(strings.toString()); + System.out.println(map.toString()); } @Test