eganwu 3 lat temu
rodzic
commit
eba948d31a

+ 52 - 4
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -234,7 +234,7 @@ public class wechatapplet extends Controller {
     public String getFilesOfPath() {
     public String getFilesOfPath() {
         String folderPath = content.getString("folderPath");
         String folderPath = content.getString("folderPath");
         //获取经销商类型
         //获取经销商类型
-        String fusertype = getUserFusertype();
+//        String fusertype = getUserFusertype();
         //获取用户角色列表
         //获取用户角色列表
         ArrayList<String> listUserRole = getUserRolesList();
         ArrayList<String> listUserRole = getUserRolesList();
         //查询对应用户的体系
         //查询对应用户的体系
@@ -293,12 +293,59 @@ public class wechatapplet extends Controller {
     List<JSONObject> listFiles = new ArrayList<>();
     List<JSONObject> listFiles = new ArrayList<>();
     List<JSONObject> listFolder = new ArrayList<>();
     List<JSONObject> listFolder = new ArrayList<>();
 
 
+
+    public List<ObjectFile> getData(List<ObjectFile> list, String query, String nextToken) {
+        DoMetaQueryRequest doMetaQueryRequest = new DoMetaQueryRequest(BUCKE_NAME_1, 100, query, "FileModifiedTime");
+        doMetaQueryRequest.setNextToken(nextToken);
+        DoMetaQueryResult doMetaQueryResult = ossClient.doMetaQuery(doMetaQueryRequest);
+        if (doMetaQueryResult.getFiles() != null) {
+            System.err.println(doMetaQueryResult.getFiles().getFile().size());
+            list.addAll(doMetaQueryResult.getFiles().getFile());
+            nextToken = doMetaQueryResult.getNextToken();
+            if (!nextToken.isEmpty()) {
+                getData(list, query, nextToken);
+            }
+        }
+        return list;
+    }
+
     /**
     /**
      * 搜索
      * 搜索
      *
      *
      * @return
      * @return
      */
      */
     public String searchFile() {
     public String searchFile() {
+
+//        ossClient.openMetaQuery(BUCKE_NAME_1);
+
+//        String value = "杭州";
+//
+//        System.out.println("start");
+//
+//        List<ObjectFile> listFiles = new ArrayList<>();
+//
+//
+//        String query = "{\"SubQueries\":[{\"Field\":\"Filename\",\"Value\":\"资料中心/\",\"Operation\":\"prefix\"},{\"Field\":\"Filename\",\"Value\":\"" + value + "\",\"Operation\":\"match\"}],\"Operation\":\"and\"}";
+//        DoMetaQueryRequest doMetaQueryRequest = new DoMetaQueryRequest(BUCKE_NAME_1, 100, query, "FileModifiedTime");
+//        DoMetaQueryResult doMetaQueryResult = ossClient.doMetaQuery(doMetaQueryRequest);
+//        if (doMetaQueryResult.getFiles() != null) {
+//            listFiles = doMetaQueryResult.getFiles().getFile();
+////            System.err.println(doMetaQueryResult.getNextToken());
+//            if (!doMetaQueryResult.getNextToken().isEmpty()) {
+//                listFiles = getData(listFiles, query, doMetaQueryResult.getNextToken());
+//            }
+//            System.err.println(listFiles.size());
+//            for (ObjectFile file : listFiles) {
+//                System.out.println("Filename: " + file.getFilename());
+//                System.out.println("Filename: " + file.getSize());
+//                System.out.println("Filename: " + file.getFileModifiedTime());
+//            }
+//        }
+//        System.out.println(listFiles.size());
+//        System.out.println("end");
+
+//        ossClient.closeMetaQuery(BUCKE_NAME_1);
+
         String keyword = "";
         String keyword = "";
         if (content.containsKey("keyword")) {
         if (content.containsKey("keyword")) {
             keyword = content.getString("keyword");
             keyword = content.getString("keyword");
@@ -309,7 +356,7 @@ public class wechatapplet extends Controller {
         }
         }
 
 
         //获取经销商类型
         //获取经销商类型
-        String fusertype = getUserFusertype();
+//        String fusertype = getUserFusertype();
         //获取用户角色列表
         //获取用户角色列表
         ArrayList<String> listUserRole = getUserRolesList();
         ArrayList<String> listUserRole = getUserRolesList();
         //查询对应用户的体系
         //查询对应用户的体系
@@ -338,14 +385,15 @@ public class wechatapplet extends Controller {
         List<JSONObject> listFiles_tmp = new ArrayList<>();
         List<JSONObject> listFiles_tmp = new ArrayList<>();
         for (JSONObject jsonObject : listFiles) {
         for (JSONObject jsonObject : listFiles) {
             String name = jsonObject.getString("name");
             String name = jsonObject.getString("name");
-            System.err.println();
+//            System.err.println();
             if (name.contains(keyword)) {
             if (name.contains(keyword)) {
                 listFiles_tmp.add(jsonObject);
                 listFiles_tmp.add(jsonObject);
             }
             }
         }
         }
         Rows rows_tmp = new Rows();
         Rows rows_tmp = new Rows();
         for (Row row : rowsName) {
         for (Row row : rowsName) {
-            if (row.getString("tfilename").contains(keyword)) {
+            String[] str = row.getString("tfilename").split("/");
+            if (str[str.length - 1].contains(keyword)) {
                 rows_tmp.add(row);
                 rows_tmp.add(row);
             }
             }
 
 

+ 5 - 5
src/dsb/com/cnd3b/service/GetWechatData.java

@@ -502,12 +502,12 @@ public class GetWechatData extends BaseClass implements Runnable {
 
 
     // 取出字符串前面的数字
     // 取出字符串前面的数字
     public static String getStartDigits(String str) {
     public static String getStartDigits(String str) {
-        System.err.println(str);
+//        System.err.println(str);
         int len = str.length();
         int len = str.length();
         int stopPos = 0;
         int stopPos = 0;
         for (int i = 0; i < len; i++) { // 遍历 str 的字符
         for (int i = 0; i < len; i++) { // 遍历 str 的字符
             char ch = str.charAt(i);
             char ch = str.charAt(i);
-            System.err.println(ch);
+//            System.err.println(ch);
             if (!(ch >= '0' && ch <= '9')) { // 如果当前字符不是数字
             if (!(ch >= '0' && ch <= '9')) { // 如果当前字符不是数字
                 stopPos = i;
                 stopPos = i;
                 break;
                 break;
@@ -520,8 +520,8 @@ public class GetWechatData extends BaseClass implements Runnable {
         Collections.sort(rows, (s1, s2) -> {
         Collections.sort(rows, (s1, s2) -> {
             String str1 = getStartDigits(s1.getString(key).replace(path, "").replace("/", ""));
             String str1 = getStartDigits(s1.getString(key).replace(path, "").replace("/", ""));
             String str2 = getStartDigits(s2.getString(key).replace(path, "").replace("/", ""));
             String str2 = getStartDigits(s2.getString(key).replace(path, "").replace("/", ""));
-            System.err.println(str1);
-            System.err.println(str2);
+//            System.err.println(str1);
+//            System.err.println(str2);
             int num1 = Integer.MAX_VALUE;
             int num1 = Integer.MAX_VALUE;
             int num2 = Integer.MAX_VALUE;
             int num2 = Integer.MAX_VALUE;
             if (!str1.equals("")) {
             if (!str1.equals("")) {
@@ -549,7 +549,7 @@ public class GetWechatData extends BaseClass implements Runnable {
         Collections.sort(listFiles, (s1, s2) -> {
         Collections.sort(listFiles, (s1, s2) -> {
             String str1 = getStartDigits(s1.getString(key));
             String str1 = getStartDigits(s1.getString(key));
             String str2 = getStartDigits(s2.getString(key));
             String str2 = getStartDigits(s2.getString(key));
-            System.err.println(str1);
+//            System.err.println(str1);
             int num1 = Integer.MAX_VALUE;
             int num1 = Integer.MAX_VALUE;
             int num2 = Integer.MAX_VALUE;
             int num2 = Integer.MAX_VALUE;
             if (!str1.equals("")) {
             if (!str1.equals("")) {

+ 2 - 2
src/dsb/com/cnd3b/utility/ExcelHelper.java

@@ -33,9 +33,9 @@ public class ExcelHelper {
             Workbook workbook = null;
             Workbook workbook = null;
             if (file.isDirectory()) {
             if (file.isDirectory()) {
                 // default create .xls
                 // default create .xls
-                workbook = new HSSFWorkbook();
+                workbook = new XSSFWorkbook();
             } else if (file.getName().endsWith(".xls")) {
             } else if (file.getName().endsWith(".xls")) {
-                workbook = new HSSFWorkbook();
+                workbook = new XSSFWorkbook();
             } else if (file.getName().endsWith(".xlsx")) {
             } else if (file.getName().endsWith(".xlsx")) {
                 workbook = new XSSFWorkbook();
                 workbook = new XSSFWorkbook();
             } else {
             } else {