夏文涛 2 лет назад
Родитель
Сommit
8f3f398651
2 измененных файлов с 72 добавлено и 82 удалено
  1. 21 29
      .idea/workspace.xml
  2. 51 53
      src/main/java/com/template/controller/SmartUserController.java

+ 21 - 29
.idea/workspace.xml

@@ -2,15 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="6c5cf517-721b-44b7-afae-e7b1b913b988" name="Default Changelist" comment="">
-      <change afterPath="$PROJECT_DIR$/src/main/java/com/template/model/vo/XwBodyVo.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-dev.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartUserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartUserMapper.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/classes/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/application-dev.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/classes/mapper/template/SmartUserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/template/SmartUserMapper.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" afterPath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" afterDir="false" />
     </list>
     <ignored path="$PROJECT_DIR$/classes/" />
     <ignored path="$PROJECT_DIR$/target/" />
@@ -28,8 +20,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="100">
-              <caret line="1570" column="50" lean-forward="true" selection-start-line="1570" selection-start-column="50" selection-end-line="1570" selection-end-column="50" />
+            <state relative-caret-position="132">
+              <caret line="338" column="127" lean-forward="true" selection-start-line="338" selection-start-column="127" selection-end-line="338" selection-end-column="127" />
             </state>
           </provider>
         </entry>
@@ -117,7 +109,6 @@
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
-      <find>rowNum</find>
       <find>从0开始统计数量 所以得+1</find>
       <find>importSmartScoreExcel</find>
       <find>headImage</find>
@@ -147,6 +138,7 @@
       <find>deleteSmartUserById</find>
       <find>deleteOldFamilyRes</find>
       <find>setInPlaceOld(</find>
+      <find>importExcel</find>
     </findStrings>
     <replaceStrings>
       <replace />
@@ -240,7 +232,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" />
@@ -531,18 +523,18 @@
       <workItem from="1709280327221" duration="24080000" />
       <workItem from="1709604835831" duration="41000" />
       <workItem from="1709604890825" duration="250000" />
-      <workItem from="1709606083794" duration="5733000" />
+      <workItem from="1709606083794" duration="7774000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="145825000" />
+    <option name="totallyTimeSpent" value="147866000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="-8" y="-8" width="1936" height="1048" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info content_ui="combo" id="Project" order="0" weight="0.6593817" />
+      <window_info content_ui="combo" id="Project" order="0" weight="0.195629" />
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info id="Designer" order="2" />
       <window_info id="JRebel" order="3" side_tool="true" />
@@ -553,8 +545,8 @@
       <window_info id="Web" order="8" side_tool="true" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" />
-      <window_info anchor="bottom" id="Run" order="2" sideWeight="0.4989059" visible="true" weight="0.32822758" />
-      <window_info anchor="bottom" id="Debug" order="3" sideWeight="0.4989059" weight="0.54595184" />
+      <window_info anchor="bottom" id="Run" order="2" sideWeight="0.4989059" weight="0.32822758" />
+      <window_info anchor="bottom" id="Debug" order="3" sideWeight="0.4989059" visible="true" weight="0.13785557" />
       <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" />
@@ -572,7 +564,7 @@
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
-      <window_info anchor="right" id="Maven" order="3" weight="0.9671773" />
+      <window_info anchor="right" id="Maven" order="3" weight="0.7253829" />
       <window_info anchor="right" id="Palette" order="4" />
       <window_info anchor="right" id="Capture Analysis" order="5" />
       <window_info anchor="right" id="Database" order="6" />
@@ -590,13 +582,13 @@
       <breakpoints>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>2131</line>
+          <line>2129</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>1528</line>
+          <line>1526</line>
           <properties />
           <option name="timeStamp" value="15" />
         </line-breakpoint>
@@ -608,7 +600,7 @@
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>1184</line>
+          <line>1182</line>
           <properties />
           <option name="timeStamp" value="17" />
         </line-breakpoint>
@@ -638,21 +630,21 @@
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>147</line>
+          <line>1471</line>
           <properties />
-          <option name="timeStamp" value="55" />
+          <option name="timeStamp" value="57" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>1473</line>
+          <line>2796</line>
           <properties />
-          <option name="timeStamp" value="57" />
+          <option name="timeStamp" value="91" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
-          <line>2798</line>
+          <line>147</line>
           <properties />
-          <option name="timeStamp" value="91" />
+          <option name="timeStamp" value="103" />
         </line-breakpoint>
       </breakpoints>
     </breakpoint-manager>
@@ -1026,8 +1018,8 @@
     </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="100">
-          <caret line="1570" column="50" lean-forward="true" selection-start-line="1570" selection-start-column="50" selection-end-line="1570" selection-end-column="50" />
+        <state relative-caret-position="132">
+          <caret line="338" column="127" lean-forward="true" selection-start-line="338" selection-start-column="127" selection-end-line="338" selection-end-column="127" />
         </state>
       </provider>
     </entry>

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

@@ -303,64 +303,62 @@ public class SmartUserController implements SmartUserControllerAPI {
                 return CommonResult.fail("导入失败");
             }
 
-            for (String cardNo : cardNos) {
-
-                //region 希沃新增编辑学生家长信息
-                //学生与家长列表,最大100条
-                List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
-                for (SmartUser student : studentDatas) {
-                    ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
-                            .studentCode(student.getCardNo())
+            //region 希沃新增编辑学生家长信息
+            //学生与家长列表,最大100条
+            List<ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem> studentParents = new ArrayList<>();
+            for (SmartUser student : studentDatas) {
+                ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem students = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
+                        .studentCode(student.getCardNo())
+                        .build();
+                studentParents.add(students);
+
+                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();
-                    studentParents.add(students);
-
-                    List<SmartUser> parentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue() && e.getAffiliate().equals(cardNo)).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;
-                    }
-                    //家长列表,最多4个
-                    students.setParents(parents);
+                    parents.add(data);
+                    ++i;
                 }
+                //家长列表,最多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);
-                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);
-                //endregion
+            //初始化客户端
+            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);
+            //endregion
 
-                if (parentResult == null) {
-                    return CommonResult.fail("希沃学生家长数据添加失败!");
-                }
+            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