钟日健
2022-05-06 61cfb19a3864e70cedaa8de38f4caf032f528455
src/main/java/org/springblade/modules/FTP/DataHanlder.java
@@ -48,6 +48,8 @@
   private IDeptService iDeptService;
   /**
    * 初始化
    */
@@ -62,6 +64,61 @@
      hanlder.iDeptService = this.iDeptService;
   }
   /**
    * 获取保安员证编号
    * @param json
    */
   public static void handlerSecurityNumerBit(String json) {
      Map map = JSON.parseObject(json, Map.class);
      //取出 key(uuid)
      String key = map.keySet().toArray()[0].toString();
      //编号前缀
      String pre = map.get(key).toString();
      Integer max = hanlder.userService.getSecurityPaperCount(pre);
      Result result = new Result(200, null, max.toString(),null);
      Map<String, Object> map1 = new HashMap<>(1);
      map1.put(key, result);
      //向外网发送数据
      FtpUtil.objectFileUploadSecurityNumberCount(map1);
   }
   /**
    * 培训报名数据处理
    * @param json
    */
   public static void handlerListTrain(String json) {
      Map map = JSON.parseObject(json, Map.class);
      //取出 key(uuid)
      String key = map.keySet().toArray()[0].toString();
      Object users = map.get(key);
      List<String > userList = JSON.parseArray(users.toString(), String.class);
      //遍历
      if (userList.size()>0) {
         List<Result> resultList = new ArrayList<>();
         //开始遍历
         for (String userId : userList) {
            //校验用户年龄
            int age = hanlder.userService.getUserAge(Long.parseLong(userId));
            //创建返回对象
            Result result1 = new Result();
            result1.setUserId(Long.parseLong(userId));
            if (age>=18 && age<=60) {
               //年龄符合要求
               result1.setCode(200);
            } else {
               //年龄不符合要求
               result1.setCode(201);
            }
            //存入结果集
            resultList.add(result1);
         }
         Result result = new Result(200, "", resultList);
         Map<String, Object> map1 = new HashMap<>(1);
         map1.put(key, result);
         //向外网发送数据
         FtpUtil.objectFileUploadListTrain(map1);
      }
   }
   /**
    * 数据处理(集合)
@@ -76,6 +133,8 @@
      //遍历
      if (userList.size()>0) {
         List<Result> resultList = new ArrayList<>();
         //创建更新用户集合对象
         List<User> updateUser = new ArrayList<>();
         //开始遍历
         for (User user : userList) {
            //取出 uuid
@@ -112,12 +171,12 @@
               user.setReasonForLeav("");
               User data = result.getUser();
               user.setId(data.getId());
               user.setCreateTime(data.getCreateTime());
               //校验保安员证编号
               Result result2 = hanlder.checkSecurityNumber(user);
               User user2 = result2.getUser();
               user2.setId(data.getId());
               //修改
               hanlder.userService.updateById(user2);
               //设置返回结果
               if (result2.getCode() == 200) {
@@ -141,6 +200,7 @@
         Result result = new Result(200, "", resultList);
         Map<String, Object> map1 = new HashMap<>(1);
         map1.put(key, result);
         System.out.println("map1 = " + map1);
         //向外网发送数据
         FtpUtil.objectFileUploadList(map1);
      }
@@ -195,6 +255,8 @@
            user1.setReasonForLeav("");
            User data = result.getUser();
            user1.setId(data.getId());
            user1.setCreateTime(data.getCreateTime());
            //校验保安员证编号
            Result result2 = hanlder.checkSecurityNumber(user1);
            User user2 = result2.getUser();