Просмотр исходного кода

添加导入数据时添加往海康平台添加用户的数据

liu 2 лет назад
Родитель
Сommit
2916c06de7
1 измененных файлов с 29 добавлено и 0 удалено
  1. 29 0
      src/main/java/com/template/controller/SmartUserController.java

+ 29 - 0
src/main/java/com/template/controller/SmartUserController.java

@@ -130,6 +130,9 @@ public class SmartUserController implements SmartUserControllerAPI {
     @Autowired
     private SmartEvaluateTeacherService smartEvaluateTeacherService;
 
+    @Autowired
+    private SmartOperationUserService smartOperationUserService;
+
     private static Logger logger = LoggerFactory.getLogger(SmartUserController.class);
 
     //region 开发自己导数据用的接口
@@ -711,6 +714,18 @@ public class SmartUserController implements SmartUserControllerAPI {
                 if (!resultBool) {
                     return CommonResult.fail("导入失败");
                 }
+//                需添加到海康平台
+                ArrayList<SmartOperationUser> operationUsers = new ArrayList<>();
+                for (SmartUser studentData : studentDatas) {
+                    Integer id = studentData.getId();
+                    SmartOperationUser smartOperationUser = new SmartOperationUser();
+                    smartOperationUser.setOperationId(id);
+                    smartOperationUser.setOperationMode("1");
+                    smartOperationUser.setStatus(1);
+                    smartOperationUser.setType(2);
+                    operationUsers.add(smartOperationUser);
+                }
+                smartOperationUserService.saveBatch(operationUsers);
 
                 List<SmartFamilyIndex> familyIndexs = new ArrayList<>();
                 //region 希沃新增编辑学生家长信息
@@ -985,6 +1000,20 @@ public class SmartUserController implements SmartUserControllerAPI {
                 if (!resultBool) {
                     return CommonResult.fail("导入失败");
                 }
+
+                //                需添加到海康平台
+                ArrayList<SmartOperationUser> operationUsers = new ArrayList<>();
+                for (SmartUser teacherData : teacherDatas) {
+                    Integer id = teacherData.getId();
+                    SmartOperationUser smartOperationUser = new SmartOperationUser();
+                    smartOperationUser.setOperationId(id);
+                    smartOperationUser.setOperationMode("1");
+                    smartOperationUser.setStatus(1);
+                    smartOperationUser.setType(3);
+                    operationUsers.add(smartOperationUser);
+                }
+                smartOperationUserService.saveBatch(operationUsers);
+
             }
         }