tangzy
2021-08-21 4736633bd34369373a918450c95bed20c440c682
src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -70,12 +70,10 @@
   private  static String ftpUserName = "yly";
   //ftp服务器密码
   private  static String ftpPassword = "Yly@123";
   //ftp服务器路径
   private  static String ftpPath = "anbao/sql.json";
   //本地路径
   private  static String localPath = "D:\\anbao";
   //文件名
   private  static String fileName = "nsql.json";
   private  static String fileName = "wsql.json";
   private final IInformationService informationService;
   private final IDeptService iDeptService;
@@ -202,7 +200,7 @@
         + "'" + dept.getTenantId() + "'" + "," + "'" + information.getEnterprisename() + "'" + "," + "'" + dept.getAncestors() + "'" + "," + "'" + dept.getDeptCategory() + "'" + ")";
         Object o = s;
         String json = JSON.toJSONString(o);
         OutJson.createJsonFile(json, "d:/", "nsql");
         OutJson.createJsonFile(json, "d:/", "wsql");
         FileInputStream in = new FileInputStream(new File("D:\\" + fileName));
         FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/", fileName, in);
      return R.success("成功");
@@ -322,87 +320,6 @@
      InforImporter inforImporter = new InforImporter(informationService, false);
      ExcelUtil.save(file, inforImporter, InforExcel.class);
      return R.success("操作成功");
   }
//   public static void main(String[] args) {
//      Information information = new Information();
//      information.setAddress("2");
//      information.setDepartmentid("123");
//      String json=JSON.toJSONString(information);//关键
//      com.util.OutJson.createJsonFile(json,"d:/anbao/information/","informationSave");
//      System.out.println("生成文件完成!");
//   }
//   @PostMapping("ss")
//   public void ss() throws FileNotFoundException {
//      //ftp服务器IP地址
//      String ftpHost = "192.168.0.105";
//      //ftp服务器端口
//      int ftpPort = 21;
//      //ftp服务器用户名
//      String ftpUserName = "yly";
//      //ftp服务器密码
//      String ftpPassword = "Yly@123";
//      //ftp服务器路径
//      String ftpPath = "";
//      //本地路径
//      String localPath = "D:\\anbao";
//      //文件名
//      String fileName = "sql.json";
//      Information information = new Information();
//      information.setCreditcode("1");
//      informationService.insertIn(information);
//      Integer id = information.getId();
//      String s = "insert into sys_information(id,creditcode) values(" + "'" + id + "'" + "," + "'" + 1 + "'" + ")";
//      Object o = s;
//      String json = JSON.toJSONString(o);
//      OutJson.createJsonFile(json, "d:/", "nsql");
//      FileInputStream in = new FileInputStream(new File("D:\\" + fileName));
//      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/", fileName, in);
//   }
//   public static void main(String[] args) throws Exception {
//      //ftp服务器IP地址
//      String ftpHost = "192.168.0.105";
//      //ftp服务器端口
//      int ftpPort = 21;
//      //ftp服务器用户名
//      String ftpUserName = "yly";
//      //ftp服务器密码
//      String ftpPassword = "Yly@123";
//      //ftp服务器路径
//      String ftpPath = "anbao/sql.json";
//      //本地路径
//      String localPath = "D:\\anbao";
//      //文件名
//      String fileName = "sql.json";
////      FtpUtil.downloadFtpFile(ftpHost, ftpUserName, ftpPassword, ftpPort, ftpPath, localPath, fileName);
//      String s = OutJson.TestJson();
//      String sql = OutJson.stringReplace(s);
//      System.out.println(sql);
//      //boolean ftpFileExist = FtpUtil.isFTPFileExist(ftpPath, ftpUserName, ftpPassword, ftpHost, ftpPort);
//      //System.out.println(ftpFileExist);
//   }
   public static void main(String[] args) {
      //
      String s = OutJson.TestJson();
      String sql = OutJson.stringReplace(s);
      String[] split = sql.split(";");//以逗号分割
      for (String string2 : split) {
         System.out.println("数据-->>>" + string2);
         String substring = string2.substring(0, 2);
         System.out.println(substring);
      }
//      //sql语句
//      String sql = OutJson.stringReplace(s);
//      String[] split = sql.split(";");
//      for (int i=0;i< split.length;i++){
//         System.out.println(split[i]);
//      }
   }