夏文涛 %!s(int64=2) %!d(string=hai) anos
pai
achega
f6eeaba642

+ 128 - 101
.idea/workspace.xml

@@ -5,7 +5,13 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="36922be1-416a-4a25-9739-9814e01883a6" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDutiesController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDutiesController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/api/SmartUserControllerAPI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/api/SmartUserControllerAPI.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/java/com/template/model/enumModel/eTimeGroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eTimeGroup.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" 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$/target/" />
@@ -21,95 +27,57 @@
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="false">
+      <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="1725">
-              <caret line="122" column="55" selection-start-line="122" selection-start-column="55" selection-end-line="122" selection-end-column="55" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="4577">
-              <caret line="240" column="44" selection-start-line="240" selection-start-column="44" selection-end-line="240" selection-end-column="44" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDutiesController.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="335">
-              <caret line="98" column="49" selection-start-line="98" selection-start-column="49" selection-end-line="98" selection-end-column="49" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/seewo/OrganizationNodeServiceInitSchoolClassesParam.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="299">
-              <caret line="13" column="24" selection-start-line="13" selection-start-column="24" selection-end-line="13" selection-end-column="24" />
+            <state relative-caret-position="-153">
+              <caret line="365" column="7" lean-forward="true" selection-start-line="365" selection-start-column="7" selection-end-line="365" selection-end-column="7" />
               <folding>
-                <element signature="imports" expanded="true" />
+                <element signature="method#logoffAccount#0;class#SmartUserController#0" />
+                <element signature="method#changeDepartment#0;class#SmartUserController#0" />
+                <element signature="method#importZipUsers#0;class#SmartUserController#0" />
+                <element signature="method#readXls#0;class#SmartUserController#0" />
+                <element signature="e#49661#49685#0" />
+                <element signature="e#49947#49964#0" />
+                <element signature="e#52515#55072#1" />
+                <element signature="e#55086#55103#0" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/WechatScanLoginController.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="215">
-              <caret line="414" column="32" selection-start-line="414" selection-start-column="24" selection-end-line="414" selection-end-column="32" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eDutiesType.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="207">
-              <caret line="9" column="12" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
-            </state>
-          </provider>
-        </entry>
-      </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SystemUserServiceImpl.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="7038">
-              <caret line="306" column="14" selection-start-line="306" selection-start-column="14" selection-end-line="306" selection-end-column="14" />
+            <state relative-caret-position="299">
+              <caret line="29" column="13" selection-start-line="29" selection-start-column="13" selection-end-line="29" selection-end-column="13" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eDuties.java">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="152">
-              <caret line="9" column="19" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="19" />
+            <state relative-caret-position="562">
+              <caret line="219" column="50" selection-start-line="219" selection-start-column="27" selection-end-line="219" selection-end-column="50" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/request/otherAppointmentRequest.java">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="253">
-              <caret line="16" column="36" selection-start-line="16" selection-start-column="13" selection-end-line="16" selection-end-column="36" />
+            <state relative-caret-position="709">
+              <caret line="73" column="43" selection-start-line="73" selection-start-column="20" selection-end-line="73" selection-end-column="43" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartAttendanceControllerAPI.java">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eTimeGroup.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="506">
-              <caret line="28" column="45" selection-start-line="28" selection-start-column="45" selection-end-line="28" selection-end-column="45" />
+            <state relative-caret-position="562">
+              <caret line="88" column="43" selection-start-line="88" selection-start-column="26" selection-end-line="88" selection-end-column="43" />
             </state>
           </provider>
         </entry>
@@ -126,6 +94,16 @@
       <find>visitingAgencys</find>
       <find>otherAppointmentRequest</find>
       <find>deleteSmartDutiesById</find>
+      <find>ver</find>
+      <find>importExcelUsers</find>
+      <find>queryPageSma</find>
+      <find>queryPageSmartIdentitys</find>
+      <find>Integer departmentId</find>
+      <find>grade</find>
+      <find>address</find>
+      <find>insert</find>
+      <find>readXlsx</find>
+      <find>studentParents</find>
     </findStrings>
   </component>
   <component name="Git.Settings">
@@ -137,13 +115,17 @@
         <option value="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartAttendanceService.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java" />
-        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" />
-        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartAttendanceController.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/api/SmartAttendanceControllerAPI.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/otherAppointmentRequest.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDutiesController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eTimeGroup.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" />
       </list>
     </option>
   </component>
@@ -347,18 +329,18 @@
       <workItem from="1706250887209" duration="5674000" />
       <workItem from="1706260354151" duration="17000" />
       <workItem from="1706260659198" duration="1213000" />
-      <workItem from="1706508631918" duration="469000" />
+      <workItem from="1706508631918" duration="19630000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="14883000" />
+    <option name="totallyTimeSpent" value="34044000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="-8" y="-8" width="1936" height="1048" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2196162" />
+      <window_info content_ui="combo" id="Project" order="0" weight="0.37260127" />
       <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" />
@@ -369,7 +351,7 @@
       <window_info id="Image Layers" order="8" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" />
-      <window_info anchor="bottom" id="Run" order="2" weight="0.32822758" />
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32822758" />
       <window_info anchor="bottom" id="Debug" order="3" weight="0.3916849" />
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -387,7 +369,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.7073561" />
+      <window_info anchor="right" id="Maven" order="3" weight="0.73741794" />
       <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" />
@@ -500,27 +482,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="425">
-          <caret line="71" column="62" selection-start-line="71" selection-start-column="62" selection-end-line="71" selection-end-column="62" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="218">
-          <caret line="156" column="47" selection-start-line="156" selection-start-column="27" selection-end-line="156" selection-end-column="47" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="195">
-          <caret line="118" column="19" selection-start-line="118" selection-start-column="19" selection-end-line="118" selection-end-column="19" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartAttendance.java">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="264">
@@ -575,13 +536,6 @@
         </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="1725">
-          <caret line="122" column="55" selection-start-line="122" selection-start-column="55" selection-end-line="122" selection-end-column="55" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="4577">
@@ -591,8 +545,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="7038">
-          <caret line="306" column="14" selection-start-line="306" selection-start-column="14" selection-end-line="306" selection-end-column="14" />
+        <state relative-caret-position="7015">
+          <caret line="305" column="14" selection-start-line="305" selection-start-column="14" selection-end-line="305" selection-end-column="14" />
         </state>
       </provider>
     </entry>
@@ -643,8 +597,81 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/WechatScanLoginController.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="215">
-          <caret line="414" column="32" selection-start-line="414" selection-start-column="24" selection-end-line="414" selection-end-column="32" />
+        <state relative-caret-position="399">
+          <caret line="422" column="20" selection-start-line="422" selection-start-column="20" selection-end-line="422" selection-end-column="20" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartIdentityControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="131">
+          <caret line="16" column="16" selection-start-line="16" selection-start-column="16" selection-end-line="16" selection-end-column="16" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartIdentityController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="269">
+          <caret line="119" column="86" selection-start-line="119" selection-start-column="63" selection-end-line="119" selection-end-column="86" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="269">
+          <caret line="50" column="20" selection-start-line="50" selection-start-column="20" selection-end-line="50" selection-end-column="20" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eTimeGroup.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="562">
+          <caret line="88" column="43" selection-start-line="88" selection-start-column="26" selection-end-line="88" selection-end-column="43" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SystemUserServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="299">
+          <caret line="29" column="13" selection-start-line="29" selection-start-column="13" selection-end-line="29" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="709">
+          <caret line="73" column="43" selection-start-line="73" selection-start-column="20" selection-end-line="73" selection-end-column="43" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="295">
+          <caret line="82" column="19" selection-start-line="82" selection-start-column="19" selection-end-line="82" selection-end-column="19" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="562">
+          <caret line="219" column="50" selection-start-line="219" selection-start-column="27" selection-end-line="219" selection-end-column="50" />
+        </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="-153">
+          <caret line="365" column="7" lean-forward="true" selection-start-line="365" selection-start-column="7" selection-end-line="365" selection-end-column="7" />
+          <folding>
+            <element signature="method#logoffAccount#0;class#SmartUserController#0" />
+            <element signature="method#changeDepartment#0;class#SmartUserController#0" />
+            <element signature="method#importZipUsers#0;class#SmartUserController#0" />
+            <element signature="method#readXls#0;class#SmartUserController#0" />
+            <element signature="e#49661#49685#0" />
+            <element signature="e#49947#49964#0" />
+            <element signature="e#52515#55072#1" />
+            <element signature="e#55086#55103#0" />
+          </folding>
         </state>
       </provider>
     </entry>

+ 1 - 1
src/main/java/com/template/api/SmartUserControllerAPI.java

@@ -42,7 +42,7 @@ public interface SmartUserControllerAPI {
      */
     @PostMapping(value = "importExcelUsers")
     @ApiOperation(value = "批量导入用户信息", notes = "批量导入用户信息", httpMethod = "POST")
-    CommonResult importExcelUsers(@RequestParam("file") MultipartFile excelFile, @RequestParam String headImage) throws IOException;
+    CommonResult importExcelUsers(@RequestParam("file") MultipartFile excelFile, @RequestParam String headImage) throws Exception;
 
     /**
      * 批量导入压缩包

+ 394 - 243
src/main/java/com/template/controller/SmartUserController.java

@@ -133,7 +133,7 @@ public class SmartUserController implements SmartUserControllerAPI {
     }
 
     @Override
-    public CommonResult importExcelUsers(MultipartFile excelFile, String headImage) throws IOException {
+    public CommonResult importExcelUsers(MultipartFile excelFile, String headImage) throws Exception {
         List<SmartUser> result = new ArrayList<>();
 
         //先解析excel如果excel不满足格式就提示错误信息 避免提前占用带宽上传头像
@@ -169,10 +169,197 @@ public class SmartUserController implements SmartUserControllerAPI {
             }
         }
 
-        //批量存储用户信息
-        boolean resultBool = smartUserService.saveBatch(result);
+        //region 将数据加入第三方
+        List<SmartUser> studentDatas = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Student.getValue()).collect(Collectors.toList());
+        for (SmartUser student : studentDatas) {
 
-        return resultBool ? CommonResult.ok("导入成功") : CommonResult.fail("导入失败");
+            //region 学生参数必填判断:年级、班级
+            if (student.getGrade() == null) {
+                return CommonResult.fail("学生年级不能为空");
+            }
+
+            if (student.getSchoolClass() == null) {
+                return CommonResult.fail("学生班级不能为空");
+            }
+            //endregion
+
+            //获取班级Uid
+            SmartClass classData = smartClassService.getSmartClassById(student.getSchoolClass());
+            if (classData == null) {
+                return CommonResult.fail("班级数据无效,新增失败");
+            }
+
+            //region 希沃新增学生信息
+            //初始化客户端
+            SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+            StudentServiceBatchSaveClassStudentsParam param = new StudentServiceBatchSaveClassStudentsParam();
+            //请求体,MimeType为 application/json
+            StudentServiceBatchSaveClassStudentsParam.JSONRequestBody requestBody = StudentServiceBatchSaveClassStudentsParam.JSONRequestBody.builder()
+                    .build();
+            param.setRequestBody(requestBody);
+            //查询条件
+            StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery query = StudentServiceBatchSaveClassStudentsParam.StudentSaveQuery.builder()
+                    .appId(seewoConfig.getAppId())
+                    .schoolUid(seewoConfig.getSchoolId())
+                    .classUid(classData.getClassUid())
+                    .build();
+            requestBody.setQuery(query);
+            // 学生列表
+            StudentServiceBatchSaveClassStudentsParam.StudentInfo students = StudentServiceBatchSaveClassStudentsParam.StudentInfo.builder()
+                    .studentName(student.getName())
+                    .studentCode(student.getCardNo())
+                    .gender(student.getSexId())
+                    .phone(student.getPhone() == null ? "" : student.getPhone())
+                    .build();
+            query.setStudents(java.util.Collections.singletonList(students));
+            query.setInPlaceOld(true);// 是否删除旧学生再保存
+            param.setRequestBody(requestBody);
+            StudentServiceBatchSaveClassStudentsRequest request = new StudentServiceBatchSaveClassStudentsRequest(param);
+            System.out.println("入参:" + request);
+            //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+            //request.setServerUrl("https://openapi.test.seewo.com")
+            //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+            StudentServiceBatchSaveClassStudentsResult studentResult = seewoClient.invoke(request);
+            System.out.println("出参:" + studentResult);
+
+            if (studentResult == null) {
+                return CommonResult.fail("希沃学生数据新增失败!");
+            }
+
+            if (!studentResult.getResponseBody().getCode().equals("000000")) {
+                return CommonResult.fail(studentResult.getResponseBody().getMessage());
+            }
+
+            student.setXwStudentUid(studentResult.getResponseBody().getData().get(0).getUserUid());
+            //endregion
+
+            //region 百胜新增学生信息
+            String appId = controlConfig.getAppId();
+            String schoolno = controlConfig.getSchoolCode();
+            String timestamp = TimeExchange.DateNowTimeStamo();
+            String appSecret = controlConfig.getAppSecret();
+            String url = controlConfig.getUrl() + "student/create";
+
+            JSONObject jsonobject = new JSONObject();
+            jsonobject.put("appid", appId);
+            String str = "{\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}";
+            String aesStr = URLEncoder.encode(AesTestOne.encrypt(str, controlConfig.getAppSecret()), "UTF-8");
+            jsonobject.put("data", aesStr);
+            jsonobject.put("schoolno", schoolno);
+            jsonobject.put("timestamp", timestamp);
+
+            String md5Str = "appid=" + appId + "&data={\"student_name\":\"" + student.getName() + "\",\"classtab_no\":\"" + classData.getBsClassNo() + "\",\"student_number\":\"" + student.getCardNo() + "\",\"student_sex\":\"" + student.getSexId() + "\",\"student_photo\":\"" + imageUtils.getBase64Url(student.getHeadImage()) + "\",\"student_tgno\":\"" + eTimeGroup.stringOf(student.getTimeGroupId()) + "\"}" + "&schoolno=" + schoolno + "&timestamp=" + timestamp + "&key=" + appSecret;
+            String sign = CommonUtil.MD5(md5Str);
+            //sign签名
+            jsonobject.put("sign", sign);
+
+            //返回的结果中 code为1表示成功
+            String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+            if (bsResult.contains("添加成功")) {
+                ObjectMapper objectMapper = new ObjectMapper();
+                BsStudentVo grade = objectMapper.readValue(bsResult, BsStudentVo.class);
+
+                // URL解码
+                String decodedUrl = URLDecoder.decode(grade.getData(), "UTF-8");
+
+                BsStudentNoVo studentNo = objectMapper.readValue(decrypt(decodedUrl, controlConfig.getAppSecret()), BsStudentNoVo.class);
+                student.setBsStudentNo(studentNo.getStudent_no());
+            }
+            //endregion
+
+        }
+
+        if (studentDatas != null && studentDatas.size() > 0) {
+            //批量存储学生信息
+            boolean resultBool = smartUserService.saveBatch(studentDatas);
+            if (!resultBool) {
+                return CommonResult.fail("导入失败");
+            }
+
+            List<String> cardNos = studentDatas.stream().map(SmartUser::getCardNo).collect(Collectors.toList());
+            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())
+                            .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);
+                }
+
+                //初始化客户端
+                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
+
+                if (parentResult == null) {
+                    return CommonResult.fail("希沃学生家长数据添加失败!");
+                }
+
+                if (!parentResult.getResponseBody().getCode().equals("000000")) {
+                    return CommonResult.fail(parentResult.getResponseBody().getMessage());
+                }
+            }
+        }
+        //endregion
+
+        List<SmartUser> parents = result.stream().filter(e -> e.getIdentityId().intValue() == eIdentityStatu.Parent.getValue()).collect(Collectors.toList());
+        List<String> cardNos = studentDatas.stream().map(SmartUser::getCardNo).collect(Collectors.toList());
+        if(cardNos != null && cardNos.size() > 0){
+            List<SmartUser> students = smartUserService.querySmartUserByCardNos(cardNos);
+            for (SmartUser parent : parents) {
+                Optional<SmartUser> student = students.stream().filter(e -> e.getCardNo().equals(parent.getAffiliate())).findFirst();
+                if(student != null && student.isPresent()){
+                    parent.setAffiliate(String.valueOf(student.get().getId()));
+                }
+            }
+            if(parents!= null && parents.size() > 0){
+                //批量存储家长信息
+                boolean resultBool = smartUserService.saveBatch(result);
+                if(!resultBool){
+                    return CommonResult.fail("导入失败!");
+                }
+            }
+        }
+
+        return CommonResult.ok("导入成功");
     }
 
 
@@ -299,136 +486,103 @@ public class SmartUserController implements SmartUserControllerAPI {
                     //然后poi会根据字符串读取它
                     //标题 校验
                     if (rowNum == 0) {
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));//学号
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (!schoolClass.equals("班级")) {
+                            return CommonResult.fail("导入数据第一列为班级");
+                        }
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));//学号
                         if (!cardNo.equals("学号")) {
-                            return CommonResult.fail("导入数据第一列为学号");
+                            return CommonResult.fail("导入数据第列为学号");
                         }
-                        String name = dataFormatter.formatCellValue(row.getCell(1));//姓名
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
                         if (!name.equals("姓名")) {
-                            return CommonResult.fail("导入数据第二列为姓名");
-                        }
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));//身份
-                        if (!identity.equals("身份")) {
-                            return CommonResult.fail("导入数据第三列为身份");
+                            return CommonResult.fail("导入数据第三列为姓名");
                         }
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));//身份证
-                        if (!idCard.equals("身份证")) {
-                            return CommonResult.fail("导入数据第四列为身份证");
-                        }
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));//性别
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));//性别
                         if (!sex.equals("性别")) {
-                            return CommonResult.fail("导入数据第五列为性别");
-                        }
-                        String department = dataFormatter.formatCellValue(row.getCell(5));//部门
-                        if (!department.equals("部门")) {
-                            return CommonResult.fail("导入数据第六列为部门");
+                            return CommonResult.fail("导入数据第四列为性别");
                         }
-                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//人脸照片
-                        if (!headImage.equals("人脸照片")) {
-                            return CommonResult.fail("导入数据第七列为人脸照片");
+                        String nation = dataFormatter.formatCellValue(row.getCell(4));//民族
+                        if (!nation.equals("民族")) {
+                            return CommonResult.fail("导入数据第五列为民族");
                         }
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        if (!dormitoryNumber.equals("宿舍号")) {
-                            return CommonResult.fail("导入数据第八列为宿舍号");
+                        String cardId = dataFormatter.formatCellValue(row.getCell(5));//身份证
+                        if (!cardId.equals("身份证")) {
+                            return CommonResult.fail("导入数据第六列为身份证");
                         }
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        if (!grade.equals("年级")) {
-                            return CommonResult.fail("导入数据第九列为年级");
+                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//照片
+                        if (!headImage.equals("照片")) {
+                            return CommonResult.fail("导入数据第七列为照片");
                         }
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        if (!schoolClass.equals("班级")) {
-                            return CommonResult.fail("导入数据第十列为班级");
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));//常规时间组
+                        if (!timeGroup.equals("常规时间组")) {
+                            return CommonResult.fail("导入数据第八列为常规时间组");
                         }
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));//手机号
-                        if (!phone.equals("手机号")) {
-                            return CommonResult.fail("导入数据第十一列为手机号");
+                        String address = dataFormatter.formatCellValue(row.getCell(8));//住址
+                        if (!address.equals("住址")) {
+                            return CommonResult.fail("导入数据第九列为住址");
                         }
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (!affiliate.equals("关联人")) {
-                            return CommonResult.fail("导入数据第十二列为关联人");
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));//联系电话
+                        if (!phone.equals("联系电话")) {
+                            return CommonResult.fail("导入数据第十列为联系电话");
                         }
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        if (!title.equals("职称")) {
-                            return CommonResult.fail("导入数据第十三列为职称");
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (!family.equals("家属")) {
+                            return CommonResult.fail("导入数据第十一列为家属");
                         }
-                        String address = dataFormatter.formatCellValue(row.getCell(13));//家庭住址
-                        if (!address.equals("家庭住址")) {
-                            return CommonResult.fail("导入数据第十四列为家庭住址");
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        if (!familyShip.equals("家属与本人关系")) {
+                            return CommonResult.fail("导入数据第十二列为家属与本人关系");
                         }
-                        String nation = dataFormatter.formatCellValue(row.getCell(14));//民族
-                        if (!nation.equals("民族")) {
-                            return CommonResult.fail("导入数据第十五列为民族");
+                        String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                        if (!phoneTwo.equals("联系电话2")) {
+                            return CommonResult.fail("导入数据第十三列为联系电话2");
                         }
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        if (!ofStudent.equals("生源地")) {
-                            return CommonResult.fail("导入数据第十六列为生源地");
+                        String familyTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!familyTwo.equals("家属2")) {
+                            return CommonResult.fail("导入数据第十四列为家属2");
                         }
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        if (!graduate.equals("毕业学校")) {
-                            return CommonResult.fail("导入数据第十七列为毕业学校");
-                        }
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        if (!duties.equals("职务")) {
-                            return CommonResult.fail("导入数据第十八列为职务");
+                        String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                        if (!familyShipTwo.equals("家属与本人关系2")) {
+                            return CommonResult.fail("导入数据第十五列为家属与本人关系2");
                         }
                     } else {
                         SmartUser user = new SmartUser();
-                        String name = dataFormatter.formatCellValue(row.getCell(1));
+                        String name = dataFormatter.formatCellValue(row.getCell(2));
                         if (ObjectUtils.isEmpty(name)) {
                             return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
                         }
 
-                        //身份是否为空判断
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));
-                        if (ObjectUtils.isEmpty(identity)) {
-                            return CommonResult.fail(name + "的身份不能为空");
-                        }
-
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        //身份为学生的情况下 宿舍号、年级、班级不能为空
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Student.getValue()) {
-                            if (ObjectUtils.isEmpty(dormitoryNumber)) {
-                                return CommonResult.fail(name + "的宿舍号不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(grade)) {
-                                return CommonResult.fail(name + "的年级不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(schoolClass)) {
-                                return CommonResult.fail(name + "的班级不能为空");
-                            }
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (ObjectUtils.isEmpty(schoolClass)) {
+                            return CommonResult.fail(name + "的班级不能为空");
                         }
 
                         //手机号重复判断
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue() || eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Teacher.getValue()) {
-                            if (ObjectUtils.isEmpty(phone)) {
-                                return CommonResult.fail(name + "的手机号不能为空");
-                            }
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));
+                        if (ObjectUtils.isEmpty(phone)) {
+                            return CommonResult.fail(name + "家属的手机号不能为空");
                         }
                         if (!ObjectUtils.isEmpty(phone)) {
                             phones.add(phone);
                         }
                         if (phones.stream().distinct().count() != phones.size()) {
-                            return CommonResult.fail("导入的Excel中,手机号:" + phone + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中,联系电话:" + phone + "存在重复数据");
                         }
 
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue()) {
-                            if (ObjectUtils.isEmpty(affiliate)) {
-                                return CommonResult.fail(name + "的关联人不能为空");
-                            }
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (ObjectUtils.isEmpty(family)) {
+                            return CommonResult.fail(name + "的家属不能为空");
                         }
 
                         //性别是否为空判断
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));
                         if (ObjectUtils.isEmpty(sex)) {
                             return CommonResult.fail(name + "的性别不能为空");
                         }
 
                         //家庭住址是否为空判断
-                        String address = dataFormatter.formatCellValue(row.getCell(13));
+                        String address = dataFormatter.formatCellValue(row.getCell(8));
                         if (ObjectUtils.isEmpty(address)) {
                             return CommonResult.fail(name + "的家庭住址不能为空");
                         }
@@ -440,54 +594,49 @@ public class SmartUserController implements SmartUserControllerAPI {
                         }
 
                         //部门是否为空判断
-                        String department = dataFormatter.formatCellValue(row.getCell(5));
+                        String department = dataFormatter.formatCellValue(row.getCell(0)).replace("年级", "") + "学生";
                         if (ObjectUtils.isEmpty(department)) {
                             return CommonResult.fail(name + "的部门不能为空");
                         }
-                        int lastIndex = department.lastIndexOf("/");
                         Integer departmentId = null;
-                        if (lastIndex >= 0) {
-                            Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department.substring(lastIndex))).findFirst();
-                            if (departModel != null && departModel.isPresent()) {
-                                departmentId = departModel.get().getId();
-                            }
+                        Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department)).findFirst();
+                        if (departModel != null && departModel.isPresent()) {
+                            departmentId = departModel.get().getId();
                         }
 
                         //学号重复判断
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));
                         if (!ObjectUtils.isEmpty(cardNo)) {
                             cardNos.add(cardNo);
                         }
                         if (cardNos.stream().distinct().count() != cardNos.size()) {
-                            return CommonResult.fail("导入的Excel中,号:" + cardNo + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的学号:" + cardNo + "存在重复数据");
                         }
 
                         //身份证重复判断
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));
+                        String idCard = dataFormatter.formatCellValue(row.getCell(5));
                         if (!ObjectUtils.isEmpty(idCard)) {
                             idCards.add(idCard);
                         }
-                        //List<String> noEmptyIdCards = idCards.stream().filter(e -> !e.equals("") || e != null).collect(Collectors.toList());
                         if (idCards.stream().distinct().count() != idCards.size()) {
-                            return CommonResult.fail("导入的Excel中,身份证号:" + idCard + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的身份证号:" + idCard + "存在重复数据");
                         }
                         user.setCardNo(cardNo == null ? "" : cardNo);
                         user.setName(name == null ? "" : name);
-                        user.setIdentityId(identity == null ? eIdentityStatu.Student.getValue() : eIdentityStatu.integerOf(identity));
+                        user.setIdentityId(eIdentityStatu.Student.getValue());
                         user.setIdCard(idCard == null ? "" : idCard);
                         user.setSexId(sex == null ? eSexStatu.Man.getValue() : eSexStatu.integerOf(sex));
                         user.setDepartmentId(departmentId);
                         String cellImage = dataFormatter.formatCellValue(row.getCell(6));
                         user.setHeadImage(cellImage);
-                        user.setDormitoryNumber(dormitoryNumber == null ? "" : dormitoryNumber);
-                        user.setGrade(grade == null ? "" : grade);
+                        user.setDormitoryNumber("");
+                        String grade = schoolClass == null ? "" : schoolClass.substring(0, 3);
+                        user.setGrade(grade);
                         Optional<SmartGrade> oGrade = grades.stream().filter(e -> e.getName().equals(grade)).findFirst();
-
                         if (oGrade != null && oGrade.isPresent()) {
                             Integer gradeId = oGrade.get().getId();
-
-                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClass) && e.getGradeId().equals(gradeId)).findFirst();
-
+                            String schoolClassStr = schoolClass.replace("grade", "");
+                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClassStr) && e.getGradeId().equals(gradeId)).findFirst();
                             if (oClass != null && oClass.isPresent()) {
                                 user.setSchoolClass(oClass.get().getId());
                             } else {
@@ -497,25 +646,46 @@ public class SmartUserController implements SmartUserControllerAPI {
                         } else {
                             return CommonResult.fail(name + "的年级数据无效,导入失败");
                         }
-
                         user.setCollege("");
                         user.setSpeciality("");
                         user.setCampus("");
                         user.setPhone(phone == null ? "" : phone);
-                        user.setAffiliate(affiliate == null ? "" : affiliate);
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        user.setTitle(title == null ? "" : title);
+                        user.setAffiliate("");
+                        user.setTitle("");
                         user.setAddress(address == null ? "" : address);
                         user.setNation(nation == null ? "" : nation);
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        user.setOfStudent(ofStudent == null ? "" : ofStudent);
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        user.setGraduate(graduate == null ? "" : graduate);
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        user.setDuties(duties == null ? null : Integer.valueOf(duties));
+                        user.setOfStudent("");
+                        user.setGraduate("");
+                        user.setDuties(null);
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));
+                        user.setTimeGroupId(eTimeGroup.integerOfTimeName(timeGroup));
                         user.setIsCancel(eLogOff.Unlogout.getValue());
 
                         result.add(user);
+
+                        //region 家属
+                        SmartUser familyOne = new SmartUser();
+                        familyOne.setName(family);
+                        familyOne.setPhone(phone);
+                        familyOne.setIdentityId(eIdentityStatu.Parent.getValue());
+                        familyOne.setAffiliate(user.getCardNo());
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        familyOne.setShip(familyShip == null ? "" : familyShip);
+                        result.add(familyOne);
+
+                        SmartUser familyTwo = new SmartUser();
+                        String familyNameTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!ObjectUtils.isEmpty(familyNameTwo)) {
+                            familyTwo.setName(familyNameTwo);
+                            String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                            familyTwo.setPhone(phoneTwo == null ? "" : phoneTwo);
+                            familyTwo.setIdentityId(eIdentityStatu.Parent.getValue());
+                            familyOne.setAffiliate(user.getCardNo());
+                            String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                            familyTwo.setShip(familyShipTwo == null ? "" : familyShipTwo);
+                            result.add(familyTwo);
+                        }
+                        //endregion
                     }
                 }
             }
@@ -558,136 +728,103 @@ public class SmartUserController implements SmartUserControllerAPI {
                     //然后poi会根据字符串读取它
                     //标题 校验
                     if (rowNum == 0) {
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));//学号
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (!schoolClass.equals("班级")) {
+                            return CommonResult.fail("导入数据第一列为班级");
+                        }
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));//学号
                         if (!cardNo.equals("学号")) {
-                            return CommonResult.fail("导入数据第一列为学号");
+                            return CommonResult.fail("导入数据第列为学号");
                         }
-                        String name = dataFormatter.formatCellValue(row.getCell(1));//姓名
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
                         if (!name.equals("姓名")) {
-                            return CommonResult.fail("导入数据第二列为姓名");
-                        }
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));//身份
-                        if (!identity.equals("身份")) {
-                            return CommonResult.fail("导入数据第三列为身份");
+                            return CommonResult.fail("导入数据第三列为姓名");
                         }
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));//身份证
-                        if (!idCard.equals("身份证")) {
-                            return CommonResult.fail("导入数据第四列为身份证");
-                        }
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));//性别
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));//性别
                         if (!sex.equals("性别")) {
-                            return CommonResult.fail("导入数据第五列为性别");
-                        }
-                        String department = dataFormatter.formatCellValue(row.getCell(5));//部门
-                        if (!department.equals("部门")) {
-                            return CommonResult.fail("导入数据第六列为部门");
-                        }
-                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//人脸照片
-                        if (!headImage.equals("人脸照片")) {
-                            return CommonResult.fail("导入数据第七列为人脸照片");
+                            return CommonResult.fail("导入数据第四列为性别");
                         }
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        if (!dormitoryNumber.equals("宿舍号")) {
-                            return CommonResult.fail("导入数据第八列为宿舍号");
+                        String nation = dataFormatter.formatCellValue(row.getCell(4));//民族
+                        if (!nation.equals("民族")) {
+                            return CommonResult.fail("导入数据第五列为民族");
                         }
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        if (!grade.equals("年级")) {
-                            return CommonResult.fail("导入数据第九列为年级");
+                        String cardId = dataFormatter.formatCellValue(row.getCell(5));//身份证
+                        if (!cardId.equals("身份证")) {
+                            return CommonResult.fail("导入数据第六列为身份证");
                         }
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        if (!schoolClass.equals("班级")) {
-                            return CommonResult.fail("导入数据第十列为班级");
+                        String headImage = dataFormatter.formatCellValue(row.getCell(6));//照片
+                        if (!headImage.equals("照片")) {
+                            return CommonResult.fail("导入数据第七列为照片");
                         }
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));//手机号
-                        if (!phone.equals("手机号")) {
-                            return CommonResult.fail("导入数据第十一列为手机号");
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));//常规时间组
+                        if (!timeGroup.equals("常规时间组")) {
+                            return CommonResult.fail("导入数据第八列为常规时间组");
                         }
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (!affiliate.equals("关联人")) {
-                            return CommonResult.fail("导入数据第十二列为关联人");
+                        String address = dataFormatter.formatCellValue(row.getCell(8));//住址
+                        if (!address.equals("住址")) {
+                            return CommonResult.fail("导入数据第九列为住址");
                         }
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        if (!title.equals("职称")) {
-                            return CommonResult.fail("导入数据第十三列为职称");
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));//联系电话
+                        if (!phone.equals("联系电话")) {
+                            return CommonResult.fail("导入数据第十列为联系电话");
                         }
-                        String address = dataFormatter.formatCellValue(row.getCell(13));//家庭住址
-                        if (!address.equals("家庭住址")) {
-                            return CommonResult.fail("导入数据第十四列为家庭住址");
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (!family.equals("家属")) {
+                            return CommonResult.fail("导入数据第十一列为家属");
                         }
-                        String nation = dataFormatter.formatCellValue(row.getCell(14));//民族
-                        if (!nation.equals("民族")) {
-                            return CommonResult.fail("导入数据第十五列为民族");
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        if (!familyShip.equals("家属与本人关系")) {
+                            return CommonResult.fail("导入数据第十二列为家属与本人关系");
                         }
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        if (!ofStudent.equals("生源地")) {
-                            return CommonResult.fail("导入数据第十六列为生源地");
+                        String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                        if (!phoneTwo.equals("联系电话2")) {
+                            return CommonResult.fail("导入数据第十三列为联系电话2");
                         }
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        if (!graduate.equals("毕业学校")) {
-                            return CommonResult.fail("导入数据第十七列为毕业学校");
+                        String familyTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!familyTwo.equals("家属2")) {
+                            return CommonResult.fail("导入数据第十四列为家属2");
                         }
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        if (!duties.equals("职务")) {
-                            return CommonResult.fail("导入数据第十八列为职务");
+                        String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                        if (!familyShipTwo.equals("家属与本人关系2")) {
+                            return CommonResult.fail("导入数据第十五列为家属与本人关系2");
                         }
                     } else {
                         SmartUser user = new SmartUser();
-                        String name = dataFormatter.formatCellValue(row.getCell(1));
+                        String name = dataFormatter.formatCellValue(row.getCell(2));
                         if (ObjectUtils.isEmpty(name)) {
                             return CommonResult.fail("第" + (rowNum + 2) + "条数据的名称不能为空");
                         }
 
-                        //身份是否为空判断
-                        String identity = dataFormatter.formatCellValue(row.getCell(2));
-                        if (ObjectUtils.isEmpty(identity)) {
-                            return CommonResult.fail(name + "的身份不能为空");
-                        }
-
-                        String dormitoryNumber = dataFormatter.formatCellValue(row.getCell(7));//宿舍号
-                        String grade = dataFormatter.formatCellValue(row.getCell(8));//年级
-                        String schoolClass = dataFormatter.formatCellValue(row.getCell(9));//班级
-                        //身份为学生的情况下 宿舍号、年级、班级不能为空
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Student.getValue()) {
-                            if (ObjectUtils.isEmpty(dormitoryNumber)) {
-                                return CommonResult.fail(name + "的宿舍号不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(grade)) {
-                                return CommonResult.fail(name + "的年级不能为空");
-                            }
-                            if (ObjectUtils.isEmpty(schoolClass)) {
-                                return CommonResult.fail(name + "的班级不能为空");
-                            }
+                        String schoolClass = dataFormatter.formatCellValue(row.getCell(0));//班级
+                        if (ObjectUtils.isEmpty(schoolClass)) {
+                            return CommonResult.fail(name + "的班级不能为空");
                         }
 
                         //手机号重复判断
-                        String phone = dataFormatter.formatCellValue(row.getCell(10));
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue() || eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Teacher.getValue()) {
-                            if (ObjectUtils.isEmpty(phone)) {
-                                return CommonResult.fail(name + "的手机号不能为空");
-                            }
+                        String phone = dataFormatter.formatCellValue(row.getCell(9));
+                        if (ObjectUtils.isEmpty(phone)) {
+                            return CommonResult.fail(name + "家属的手机号不能为空");
                         }
                         if (!ObjectUtils.isEmpty(phone)) {
                             phones.add(phone);
                         }
                         if (phones.stream().distinct().count() != phones.size()) {
-                            return CommonResult.fail("导入的Excel中,手机号:" + phone + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中,联系电话:" + phone + "存在重复数据");
                         }
 
-                        String affiliate = dataFormatter.formatCellValue(row.getCell(11));//关联人
-                        if (eIdentityStatu.integerOf(identity).intValue() == eIdentityStatu.Parent.getValue()) {
-                            if (ObjectUtils.isEmpty(affiliate)) {
-                                return CommonResult.fail(name + "的关联人不能为空");
-                            }
+                        String family = dataFormatter.formatCellValue(row.getCell(10));//家属
+                        if (ObjectUtils.isEmpty(family)) {
+                            return CommonResult.fail(name + "的家属不能为空");
                         }
 
                         //性别是否为空判断
-                        String sex = dataFormatter.formatCellValue(row.getCell(4));
+                        String sex = dataFormatter.formatCellValue(row.getCell(3));
                         if (ObjectUtils.isEmpty(sex)) {
                             return CommonResult.fail(name + "的性别不能为空");
                         }
 
                         //家庭住址是否为空判断
-                        String address = dataFormatter.formatCellValue(row.getCell(13));
+                        String address = dataFormatter.formatCellValue(row.getCell(8));
                         if (ObjectUtils.isEmpty(address)) {
                             return CommonResult.fail(name + "的家庭住址不能为空");
                         }
@@ -699,55 +836,49 @@ public class SmartUserController implements SmartUserControllerAPI {
                         }
 
                         //部门是否为空判断
-                        String department = dataFormatter.formatCellValue(row.getCell(5));
+                        String department = dataFormatter.formatCellValue(row.getCell(0)).replace("年级", "") + "学生";
                         if (ObjectUtils.isEmpty(department)) {
                             return CommonResult.fail(name + "的部门不能为空");
                         }
-                        int lastIndex = department.lastIndexOf("/");
                         Integer departmentId = null;
-                        if (lastIndex >= 0) {
-                            Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department.substring(lastIndex))).findFirst();
-                            if (departModel != null && departModel.isPresent()) {
-                                departmentId = departModel.get().getId();
-                            }
+                        Optional<SmartDepartment> departModel = departments.stream().filter(e -> e.getName().equals(department)).findFirst();
+                        if (departModel != null && departModel.isPresent()) {
+                            departmentId = departModel.get().getId();
                         }
 
-
                         //学号重复判断
-                        String cardNo = dataFormatter.formatCellValue(row.getCell(0));
+                        String cardNo = dataFormatter.formatCellValue(row.getCell(1));
                         if (!ObjectUtils.isEmpty(cardNo)) {
                             cardNos.add(cardNo);
                         }
                         if (cardNos.stream().distinct().count() != cardNos.size()) {
-                            return CommonResult.fail("导入的Excel中,号:" + cardNo + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的学号:" + cardNo + "存在重复数据");
                         }
 
                         //身份证重复判断
-                        String idCard = dataFormatter.formatCellValue(row.getCell(3));
+                        String idCard = dataFormatter.formatCellValue(row.getCell(5));
                         if (!ObjectUtils.isEmpty(idCard)) {
                             idCards.add(idCard);
                         }
-                        //List<String> noEmptyIdCards = idCards.stream().filter(e -> !e.equals("") || e != null).collect(Collectors.toList());
                         if (idCards.stream().distinct().count() != idCards.size()) {
-                            return CommonResult.fail("导入的Excel中,身份证号:" + idCard + "存在重复数据");
+                            return CommonResult.fail("导入的Excel中," + name + "的身份证号:" + idCard + "存在重复数据");
                         }
                         user.setCardNo(cardNo == null ? "" : cardNo);
                         user.setName(name == null ? "" : name);
-                        user.setIdentityId(identity == null ? eIdentityStatu.Student.getValue() : eIdentityStatu.integerOf(identity));
+                        user.setIdentityId(eIdentityStatu.Student.getValue());
                         user.setIdCard(idCard == null ? "" : idCard);
                         user.setSexId(sex == null ? eSexStatu.Man.getValue() : eSexStatu.integerOf(sex));
                         user.setDepartmentId(departmentId);
                         String cellImage = dataFormatter.formatCellValue(row.getCell(6));
                         user.setHeadImage(cellImage);
-                        user.setDormitoryNumber(dormitoryNumber == null ? "" : dormitoryNumber);
-                        user.setGrade(grade == null ? "" : grade);
+                        user.setDormitoryNumber("");
+                        String grade = schoolClass == null ? "" : schoolClass.substring(0, 3);
+                        user.setGrade(grade);
                         Optional<SmartGrade> oGrade = grades.stream().filter(e -> e.getName().equals(grade)).findFirst();
-
                         if (oGrade != null && oGrade.isPresent()) {
                             Integer gradeId = oGrade.get().getId();
-
-                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClass) && e.getGradeId().equals(gradeId)).findFirst();
-
+                            String schoolClassStr = schoolClass.replace("grade", "");
+                            Optional<SmartClass> oClass = classs.stream().filter(e -> e.getName().equals(schoolClassStr) && e.getGradeId().equals(gradeId)).findFirst();
                             if (oClass != null && oClass.isPresent()) {
                                 user.setSchoolClass(oClass.get().getId());
                             } else {
@@ -761,20 +892,40 @@ public class SmartUserController implements SmartUserControllerAPI {
                         user.setSpeciality("");
                         user.setCampus("");
                         user.setPhone(phone == null ? "" : phone);
-                        user.setAffiliate(affiliate == null ? "" : affiliate);
-                        String title = dataFormatter.formatCellValue(row.getCell(12));//职称
-                        user.setTitle(title == null ? "" : title);
+                        user.setAffiliate("");
+                        user.setTitle("");
                         user.setAddress(address == null ? "" : address);
                         user.setNation(nation == null ? "" : nation);
-                        String ofStudent = dataFormatter.formatCellValue(row.getCell(15));//生源地
-                        user.setOfStudent(ofStudent == null ? "" : ofStudent);
-                        String graduate = dataFormatter.formatCellValue(row.getCell(16));//毕业学校
-                        user.setGraduate(graduate == null ? "" : graduate);
-                        String duties = dataFormatter.formatCellValue(row.getCell(17));//职务
-                        user.setDuties(duties == null ? null : Integer.valueOf(duties));
+                        user.setOfStudent("");
+                        user.setGraduate("");
+                        user.setDuties(null);
+                        String timeGroup = dataFormatter.formatCellValue(row.getCell(7));
+                        user.setTimeGroupId(eTimeGroup.integerOfTimeName(timeGroup));
                         user.setIsCancel(eLogOff.Unlogout.getValue());
 
                         result.add(user);
+
+                        //region 家属
+                        SmartUser familyOne = new SmartUser();
+                        familyOne.setName(family);
+                        familyOne.setPhone(phone);
+                        familyOne.setIdentityId(eIdentityStatu.Parent.getValue());
+                        String familyShip = dataFormatter.formatCellValue(row.getCell(11));//家属与本人关系
+                        familyOne.setShip(familyShip == null ? "" : familyShip);
+                        result.add(familyOne);
+
+                        SmartUser familyTwo = new SmartUser();
+                        String familyNameTwo = dataFormatter.formatCellValue(row.getCell(13));//家属2
+                        if (!ObjectUtils.isEmpty(familyNameTwo)) {
+                            familyTwo.setName(familyNameTwo);
+                            String phoneTwo = dataFormatter.formatCellValue(row.getCell(12));//联系电话2
+                            familyTwo.setPhone(phoneTwo == null ? "" : phoneTwo);
+                            familyTwo.setIdentityId(eIdentityStatu.Parent.getValue());
+                            String familyShipTwo = dataFormatter.formatCellValue(row.getCell(14));//家属与本人关系2
+                            familyTwo.setShip(familyShipTwo == null ? "" : familyShipTwo);
+                            result.add(familyTwo);
+                        }
+                        //endregion
                     }
                 }
             }
@@ -1345,7 +1496,7 @@ public class SmartUserController implements SmartUserControllerAPI {
             //返回的结果中 code为1表示成功
             String bsResult = RequestUtils.httpPost(url, jsonobject.toJSONString());
 
-            if(bsResult.contains("人员不存在或已删除")){
+            if (bsResult.contains("人员不存在或已删除")) {
                 //获取班级Uid
                 SmartClass classData = smartClassService.getSmartClassById(usur.getSchoolClass());
                 if (classData == null) {
@@ -1516,7 +1667,7 @@ public class SmartUserController implements SmartUserControllerAPI {
 
             for (UserVo data : result.getList()) {
                 Optional<SmartIdentity> identityData = idnetitys.stream().filter(e -> e.getId().equals(data.getIdentityId())).findFirst();
-                if(identityData != null && identityData.isPresent()){
+                if (identityData != null && identityData.isPresent()) {
                     data.setIdentity(identityData.get().getName());
                 }
 
@@ -1850,7 +2001,7 @@ public class SmartUserController implements SmartUserControllerAPI {
                 return CommonResult.fail("当前学生信息已绑定过,请勿重复操作!");
             }
 
-            parentUser.setAffiliate(parentUser.getAffiliate() + "," +String.valueOf(studentUser.getId()));
+            parentUser.setAffiliate(parentUser.getAffiliate() + "," + String.valueOf(studentUser.getId()));
         }
 
         //region 新增希沃学生家长信息

+ 29 - 3
src/main/java/com/template/model/enumModel/eTimeGroup.java

@@ -63,11 +63,37 @@ public enum eTimeGroup {
     public static String stringOfName(Integer value) {
         switch (value) {
             case 1:
-                return "上午";
+                return "上午时间组";
             case 2:
-                return "中午";
+                return "中午时间组";
             case 3:
-                return "下午";
+                return "傍晚时间组";
+            default:
+                return null;
+        }
+    }
+
+    public static String stringOfTimeName(String value) {
+        switch (value) {
+            case "上午时间组":
+                return "TG1701918449235594";
+            case "中午时间组":
+                return "TG1701747145136852";
+            case "傍晚时间组":
+                return "TG1701747243082762";
+            default:
+                return null;
+        }
+    }
+
+    public static Integer integerOfTimeName(String value) {
+        switch (value) {
+            case "上午时间组":
+                return 1;
+            case "中午时间组":
+                return 2;
+            case "傍晚时间组":
+                return 3;
             default:
                 return null;
         }

+ 3 - 0
src/main/java/com/template/model/pojo/SmartUser.java

@@ -127,6 +127,9 @@ public class SmartUser implements Serializable {
     @ApiModelProperty(value = "百胜教师编号")
     private String bsStaffCode;
 
+    @ApiModelProperty(value = "家属关系")
+    private String ship;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 2 - 0
src/main/java/com/template/services/SmartUserService.java

@@ -70,4 +70,6 @@ public interface SmartUserService extends IService<SmartUser> {
     SmartUser getSmartById(Integer id);
 
     List<SmartUser> getSmartUserByxwuids(List<String> xwuids);
+
+    List<SmartUser> querySmartUserByCardNos(List<String> cardNos);
 }

+ 2 - 1
src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java

@@ -10,6 +10,7 @@ import com.template.services.SmartIdentityService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.List;
 
@@ -50,7 +51,7 @@ public class SmartIdentityServiceImpl extends ServiceImpl<SmartIdentityMapper, S
     public PageUtils<SmartIdentity> queryPageSmartIdentitys(int currentPage, int pageCount, String name) {
         Page<SmartIdentity> page = new Page<>(currentPage, pageCount);
         QueryWrapper<SmartIdentity> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.like(StringUtils.hasText(name), "name", name);
+        queryWrapper.like(StringUtils.hasText(name), "name", name);
         IPage<SmartIdentity> result = smartIdentityMapper.selectPage(page,queryWrapper);
         return new PageUtils<>(result);
     }

+ 8 - 0
src/main/java/com/template/services/impl/SmartUserServiceImpl.java

@@ -216,4 +216,12 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
         return result;
     }
 
+    @Override
+    public List<SmartUser> querySmartUserByCardNos(List<String> cardNos){
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("is_cancel", 0);
+        queryWrapper.in("card_no", cardNos);
+        List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
+        return result;
+    }
 }

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