溪鸭夏 2 лет назад
Родитель
Сommit
804aba114c

+ 20 - 32
.idea/workspace.xml

@@ -22,8 +22,8 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDepartmentController.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="1233">
-              <caret line="240" column="43" selection-start-line="240" selection-start-column="24" selection-end-line="240" selection-end-column="43" />
+            <state relative-caret-position="1442">
+              <caret line="359" selection-start-line="359" selection-end-line="359" />
             </state>
           </provider>
         </entry>
@@ -31,8 +31,8 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="226">
-              <caret line="318" column="28" selection-start-line="318" selection-start-column="28" selection-end-line="318" selection-end-column="28" />
+            <state relative-caret-position="2556">
+              <caret line="287" column="113" selection-start-line="287" selection-start-column="113" selection-end-line="287" selection-end-column="113" />
               <folding>
                 <element signature="imports" expanded="true" />
               </folding>
@@ -71,7 +71,6 @@
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
-      <find>getSmartGrades</find>
       <find>加</find>
       <find>LocalDate</find>
       <find>8月31日</find>
@@ -97,10 +96,11 @@
       <find>queryTimeGroups</find>
       <find>导入</find>
       <find>希沃新增</find>
-      <find>queryDepartmentTree</find>
       <find>address</find>
       <find>readXlsx</find>
       <find>希沃新增编辑学生家长信息</find>
+      <find>orderBy</find>
+      <find>queryDepartmentTree</find>
     </findStrings>
     <replaceStrings>
       <replace />
@@ -161,7 +161,7 @@
   <component name="MavenRunner">
     <option name="skipTests" value="true" />
   </component>
-  <component name="ProjectFrameBounds">
+  <component name="ProjectFrameBounds" extendedState="6">
     <option name="x" value="-7" />
     <option name="width" value="974" />
     <option name="height" value="1039" />
@@ -355,15 +355,15 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1712903307839</updated>
-      <workItem from="1712903309092" duration="37536000" />
+      <workItem from="1712903309092" duration="41586000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="37536000" />
+    <option name="totallyTimeSpent" value="41586000" />
   </component>
   <component name="ToolWindowManager">
-    <frame x="-7" y="0" width="974" height="1039" extended-state="0" />
+    <frame x="-8" y="-8" width="1936" height="1048" extended-state="6" />
     <editor active="true" />
     <layout>
       <window_info id="JRebel" side_tool="true" />
@@ -373,7 +373,7 @@
       <window_info id="Favorites" side_tool="true" />
       <window_info id="Designer" />
       <window_info id="Web" side_tool="true" />
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1761488" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.0858209" />
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info anchor="bottom" id="Spring" weight="0.32932165" />
       <window_info anchor="bottom" id="Event Log" side_tool="true" />
@@ -387,12 +387,12 @@
       <window_info anchor="bottom" id="JRebel Console" side_tool="true" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" weight="0.32932165" />
-      <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.45414364" />
+      <window_info anchor="bottom" id="Run" order="2" weight="0.44967178" />
       <window_info anchor="bottom" id="Debug" order="3" weight="0.20568928" />
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="6" />
-      <window_info anchor="right" id="Maven" weight="0.85667396" />
+      <window_info anchor="right" id="Maven" weight="0.9671773" />
       <window_info anchor="right" id="Palette" />
       <window_info anchor="right" id="Capture Analysis" />
       <window_info anchor="right" id="Database" />
@@ -412,12 +412,6 @@
     <breakpoint-manager>
       <breakpoints>
         <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDepartmentController.java</url>
-          <line>242</line>
-          <properties />
-          <option name="timeStamp" value="2" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/common/utils/AesUtils.java</url>
           <line>57</line>
           <properties />
@@ -443,28 +437,22 @@
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>1042</line>
+          <line>1053</line>
           <properties />
           <option name="timeStamp" value="14" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>2754</line>
+          <line>2765</line>
           <properties />
           <option name="timeStamp" value="29" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>2846</line>
+          <line>2857</line>
           <properties />
           <option name="timeStamp" value="31" />
         </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>308</line>
-          <properties />
-          <option name="timeStamp" value="45" />
-        </line-breakpoint>
       </breakpoints>
     </breakpoint-manager>
   </component>
@@ -817,15 +805,15 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDepartmentController.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1233">
-          <caret line="240" column="43" selection-start-line="240" selection-start-column="24" selection-end-line="240" selection-end-column="43" />
+        <state relative-caret-position="1442">
+          <caret line="359" selection-start-line="359" selection-end-line="359" />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="226">
-          <caret line="318" column="28" selection-start-line="318" selection-start-column="28" selection-end-line="318" selection-end-column="28" />
+        <state relative-caret-position="2556">
+          <caret line="287" column="113" selection-start-line="287" selection-start-column="113" selection-end-line="287" selection-end-column="113" />
           <folding>
             <element signature="imports" expanded="true" />
           </folding>

+ 64 - 53
src/main/java/com/template/controller/SmartUserController.java

@@ -277,66 +277,77 @@ public class SmartUserController implements SmartUserControllerAPI {
 
             //region 希沃新增编辑学生家长信息
             if (useXw == 1) {
-                //学生与家长列表,最大100条
-                List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
-                for (SmartUser student : studentDatas) {
-                    ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
-                            .studentCode(student.getCardNo())
-                            .build();
-
+                int num =  (int)Math.ceil((double)studentDatas.size() / 100);
+                for (int count = 1;count <= num;count ++) {
+                    int startIndex = (count - 1) * 100;
+                    int endIndex = count * 100;
+                    if(count == num){
+                        endIndex = startIndex + (studentDatas.size() % 100);
+                    }
 
-                    List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(student.getCardNo())).collect(Collectors.toList());
-                    List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
-                    int i = 0;
-                    for (SmartUser parent : parentDatas) {
-                        ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
-                                .name(parent.getName())
-                                .phone(parent.getPhone())
-                                .index(i)
+                    List<SmartUser> currentStudentDatas = studentDatas.subList(startIndex ,endIndex);//结尾不包含下标100
+                    //学生与家长列表,最大100条
+                    List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
+                    for (SmartUser student : currentStudentDatas) {
+                        ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
+                                .studentCode(student.getCardNo())
                                 .build();
-                        parents.add(data);
-                        ++i;
+
+
+                        List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(student.getCardNo())).collect(Collectors.toList());
+                        List<ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem> parents = new ArrayList<>();
+                        int i = 0;
+                        for (SmartUser parent : parentDatas) {
+                            ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem data = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
+                                    .name(parent.getName())
+                                    .phone(parent.getPhone())
+                                    .index(i)
+                                    .build();
+                            parents.add(data);
+                            ++i;
+                        }
+
+                        if(parents != null && parents.size() > 0){
+                            studentParents.add(students);
+                            //家长列表,最多4个
+                            students.setParents(parents);
+                        }
                     }
 
-                    if(parents != null && parents.size() > 0){
-                        studentParents.add(students);
-                        //家长列表,最多4个
-                        students.setParents(parents);
+                    //初始化客户端
+                    SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+                    ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
+                    //响应体,MimeType为 application/json
+                    ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
+                            .build();
+                    param.setRequestBody(requestBody);
+                    //query
+                    ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
+                            .appId(seewoConfig.getAppId())
+                            .schoolUid(seewoConfig.getSchoolId())
+                            .build();
+                    requestBody.setQuery(query);
+                    query.setStudentParents(studentParents);
+                    param.setRequestBody(requestBody);
+                    ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
+                    String jsonString = JSON.toJSONString(request);
+                    System.out.println("入参:" + request);
+                    //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+                    //request.setServerUrl("https://openapi.test.seewo.com")
+                    //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+                    ParentServiceBatchSaveOrUpdateParentsResult parentResult = seewoClient.invoke(request);
+                    System.out.println("出参:" + parentResult);
+
+
+                    if (parentResult == null) {
+                        return CommonResult.fail("希沃学生家长数据添加失败!");
                     }
-                }
 
-                //初始化客户端
-                SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
-                ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
-                //响应体,MimeType为 application/json
-                ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
-                        .build();
-                param.setRequestBody(requestBody);
-                //query
-                ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
-                        .appId(seewoConfig.getAppId())
-                        .schoolUid(seewoConfig.getSchoolId())
-                        .build();
-                requestBody.setQuery(query);
-                query.setStudentParents(studentParents);
-                param.setRequestBody(requestBody);
-                ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
-                String jsonString = JSON.toJSONString(request);
-                System.out.println("入参:" + request);
-                //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
-                //request.setServerUrl("https://openapi.test.seewo.com")
-                //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
-                ParentServiceBatchSaveOrUpdateParentsResult parentResult = seewoClient.invoke(request);
-                System.out.println("出参:" + parentResult);
-
-
-                if (parentResult == null) {
-                    return CommonResult.fail("希沃学生家长数据添加失败!");
-                }
-
-                if (!parentResult.getResponseBody().getCode().equals("000000")) {
-                    return CommonResult.fail(parentResult.getResponseBody().getMessage());
+                    if (!parentResult.getResponseBody().getCode().equals("000000")) {
+                        return CommonResult.fail(parentResult.getResponseBody().getMessage());
+                    }
                 }
+
             }
             //endregion
         }

BIN
target/mybatis_plus-0.0.1-SNAPSHOT.jar.original