Ver Fonte

修复附件bug

吴志根 há 4 anos atrás
pai
commit
8280fa433b

+ 1 - 1
src/dsb/com/cnd3b/common/Controller.java

@@ -99,7 +99,7 @@ public class Controller extends BaseClass {
             fphonenumber = row.getString("fphonenumber");
             fissysadministrator = row.getBoolean("fissysadministrator");
             fisadministrator = row.getBoolean("fisadministrator");
-            createRequestLog();
+//            createRequestLog();
         } else if ($classname.contains("publicmethod")) {
             siteid = (String) content.getOrDefault("siteid", parameter.defaultsiteid);
         }

+ 1 - 1
src/dsb/com/cnd3b/common/parameter/parameter.java

@@ -25,7 +25,7 @@ public class parameter {
     public static HashMap<Long, Row> userIdList = new HashMap<>(16);
 
     public static String defaultsiteid = "JIUSHENG";
-    public static Boolean isMac = false;
+    public static Boolean isMac = true;
     public static String tuserid = "";
 
     /**

+ 3 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/新增日志.sql

@@ -0,0 +1,3 @@
+INSERT INTO tuserrequestlog (tuserrequestlogid, siteid, rmkenable, fdate, flastrequestdate, frequesttimes, tuserid,
+                             ftype)
+VALUES ($tuserrequestlogid$, $siteid$, 0, $fdate$, $flastrequestdate$, 1, $tuserid$, 'Åàѵѧϰ')

+ 34 - 32
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -59,7 +59,8 @@ public class wechatapplet extends Controller {
             }
 
         }
-        saveLog("培训学习");
+
+        createRequestLog();
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }
 
@@ -91,10 +92,17 @@ public class wechatapplet extends Controller {
         if (rows.isEmpty()) {
             return getErrReturnObject().setErrMsg("未找到当前课件").toString();
         }
-        saveLog("培训学习");
+
+        createRequestLog();
         return getSucReturnObject().setData(rows.get(0)).toString();
     }
 
+    /**
+     * 获取分类
+     *
+     * @return
+     * @throws P2Exception
+     */
     public String getTypeList() throws P2Exception {
 
         String fusertype = content.getString("fusertype");
@@ -112,42 +120,36 @@ public class wechatapplet extends Controller {
         sqlFactory.addParameter_SQL("where", where);
         String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sql);
-        saveLog("培训学习");
+
+        createRequestLog();
         return getSucReturnObject().setData(rows).toString();
     }
 
 
     /**
-     * 保存信息
-     *
-     * @param ftype
-     * @throws P2Exception
+     * 新增日志
      */
-    public void saveLog(String ftype) throws P2Exception {
-
-        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tuserrequestlog", "fdate = '" + getDate_Str() + "' AND tuserid = '" + parameter.tuserid + "'");
-        if (paoSetRemote.isEmpty()) {
-            PaoRemote paoRemote = paoSetRemote.addAtEnd();
-            paoRemote.setValue("tuserid", parameter.tuserid);
-            paoRemote.setValue("siteid", parameter.defaultsiteid);
-            paoRemote.setValue("fdate", getDate_Str());
-            paoRemote.setValue("flastrequestdate", getDateTime_Str());
-            paoRemote.setValue("frequesttimes", "1");
-            paoRemote.setValue("ftype", ftype);
-
-        } else {
-            PaoRemote paoRemote = paoSetRemote.getPao(0);
-            paoRemote.setValue("tuserid", parameter.tuserid);
-            paoRemote.setValue("siteid", parameter.defaultsiteid);
-            paoRemote.setValue("fdate", getDate_Str());
-            paoRemote.setValue("flastrequestdate", getDateTime_Str());
-            paoRemote.setValue("frequesttimes", paoRemote.getInt("frequesttimes") + 1, 11L);
-            paoRemote.setValue("ftype", ftype);
-        }
-
-        paoSetRemote.save();
-
-
+    private void createRequestLog() {
+        new Thread() {
+            @Override
+            public void run() {
+                String sql = "SELECT*FROM tuserrequestlog WHERE fdate='" + getDate_Str() + "' AND tuserid='" + parameter.tuserid + "'";
+                Rows rows = dbConnect.runSqlQuery(sql);
+                if (rows.isEmpty()) {
+                    SQLFactory sqlFactory = new SQLFactory(this, "新增日志");
+                    sqlFactory.addParameter("tuserrequestlogid", createTableID("tuserrequestlog", "tuserrequestlogid"));
+                    sqlFactory.addParameter("siteid", parameter.defaultsiteid);
+                    sqlFactory.addParameter("fdate", getDate_Str());
+                    sqlFactory.addParameter("flastrequestdate", getDateTime_Str());
+                    sqlFactory.addParameter("tuserid", parameter.tuserid);
+                    dbConnect.runSqlUpdate(sqlFactory.getSQL());
+                } else {
+                    String id = rows.get(0).getString("tuserrequestlogid");
+                    String sqlUpdate = "UPDATE tuserrequestlog SET frequesttimes=frequesttimes+1,flastrequestdate = '" + getDateTime_Str() + "' WHERE tuserrequestlogid = '" + id + "'";
+                    dbConnect.runSqlUpdate(sqlUpdate);
+                }
+            }
+        }.start();
     }
 
 }

+ 202 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/datacenter/datacenter.java

@@ -0,0 +1,202 @@
+package com.cnd3b.restcontroller.enterprise.datacenter;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.*;
+import com.cnd3b.common.Controller;
+import com.cnd3b.utility.aliyun.oss.AliyunOSSConfigConstant;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class datacenter extends Controller {
+
+    //仓库名称-资料中心
+    String BUCKE_NAME = "js-data-1";
+    OSS ossClient;
+
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public datacenter(JSONObject content) {
+        super(content);
+        if (ossClient == null) {
+            ossClient = new OSSClientBuilder().build(AliyunOSSConfigConstant.END_POINT, AliyunOSSConfigConstant.AccessKey_ID, AliyunOSSConfigConstant.AccessKey_Secret);
+        }
+    }
+
+
+    /**
+     * 创建文件夹(OSS)
+     *
+     * @return
+     */
+    public String createFolder() {
+        String folderName = content.getString("folderName");
+        if (folderName.equals("") || folderName == null) {
+            return getErrReturnObject().setErrMsg("文件夹名称不能为空").toString();
+        }
+        ossClient.putObject(new PutObjectRequest(BUCKE_NAME, folderName, new ByteArrayInputStream("".getBytes())));
+        ossClient.shutdown();
+        return getSucReturnObject().toString();
+    }
+
+    /**
+     * 删除文件夹(OSS)
+     *
+     * @return
+     */
+    public String deleteFolder() {
+        JSONArray jsonArray = content.getJSONArray("folderName");
+        if (jsonArray == null || jsonArray.size() == 0) {
+            return getErrReturnObject().setErrMsg("文件夹名称不能为空").toString();
+        }
+        List<String> keysList = new ArrayList<>();
+        for (Object obj : jsonArray) {
+            keysList.add(obj.toString());
+        }
+        DeleteObjectsRequest request = new DeleteObjectsRequest(BUCKE_NAME);
+        request.setKeys(keysList);
+        // 发起deleteObjects请求。
+        DeleteObjectsResult delObjResult = ossClient.deleteObjects(request);
+
+        // 查看删除结果。
+        for (String o : delObjResult.getDeletedObjects()) {
+            String keyName = null;
+            try {
+                keyName = URLDecoder.decode(o, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            System.out.println("delete key name: " + keyName);
+        }
+
+        ossClient.shutdown();
+        return getSucReturnObject().toString();
+    }
+
+    /**
+     * 上传文件(OSS)
+     *
+     * @return
+     */
+    public String uploadFile() {
+        String filePath = content.getString("filePath");
+        String folderPath = content.getString("folderPath");
+        if (filePath.equals("") || filePath == null) {
+            return getErrReturnObject().setErrMsg("文件路径不能为空").toString();
+        }
+        if (folderPath.equals("") || folderPath == null) {
+            folderPath = "";
+        }
+        File file = new File(filePath);
+        if (!file.exists()) {
+            return getErrReturnObject().setErrMsg("文件不存在").toString();
+        }
+
+        String key = folderPath + file.getName();
+        System.err.println(key);
+
+        ossClient.putObject(new PutObjectRequest(BUCKE_NAME, key, file));
+        ossClient.shutdown();
+        return getSucReturnObject().toString();
+    }
+
+    /**
+     * 删除文件(OSS)
+     *
+     * @return
+     */
+    public String deleteFile() {
+        JSONArray jsonArray = content.getJSONArray("folderName");
+        if (jsonArray == null || jsonArray.size() == 0) {
+            return getErrReturnObject().setErrMsg("文件夹名称不能为空").toString();
+        }
+        List<String> keysList = new ArrayList<>();
+        for (Object obj : jsonArray) {
+            keysList.add(obj.toString());
+        }
+        DeleteObjectsRequest request = new DeleteObjectsRequest(BUCKE_NAME);
+        request.setKeys(keysList);
+        // 发起deleteObjects请求。
+        DeleteObjectsResult delObjResult = ossClient.deleteObjects(request);
+
+        // 查看删除结果。
+        for (String o : delObjResult.getDeletedObjects()) {
+            String keyName = null;
+            try {
+                keyName = URLDecoder.decode(o, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            System.out.println("delete key name: " + keyName);
+        }
+
+        ossClient.shutdown();
+        return getSucReturnObject().toString();
+    }
+
+    /**
+     * 获取文件夹
+     *
+     * @return
+     */
+    public String getFolders() {
+
+
+        return "";
+    }
+
+    /**
+     * 获取文件
+     *
+     * @return
+     */
+    public String getFiles() {
+
+
+        return "";
+    }
+
+    public String getAllFolders() {
+        String folderPath = content.getString("folderPath");
+        // 构造ListObjectsRequest请求。
+        ListObjectsRequest listObjectsRequest = new ListObjectsRequest(BUCKE_NAME);
+        // 设置正斜线(/)为文件夹的分隔符。
+        listObjectsRequest.setDelimiter("/");
+        // 列出fun目录下的所有文件和文件夹。
+        listObjectsRequest.setPrefix(folderPath);
+        ObjectListing listing = ossClient.listObjects(listObjectsRequest);
+        // 遍历所有文件。
+        System.out.println("Objects:");
+        List<String> objectSummaryList = new ArrayList<>();
+        for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) {
+            objectSummaryList.add(objectSummary.getKey());
+        }
+
+        // 遍历所有commonPrefix。
+        System.out.println("CommonPrefixes:");
+        List<String> commonPrefixList = new ArrayList<>();
+        for (String commonPrefix : listing.getCommonPrefixes()) {
+            commonPrefixList.add(commonPrefix);
+        }
+        // 关闭OSSClient。
+        ossClient.shutdown();
+
+        JSONObject object = new JSONObject();
+        object.put("files", objectSummaryList);
+        object.put("folder", commonPrefixList);
+        return getSucReturnObject().setData(object).toString();
+    }
+
+
+}

+ 5 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tadministrators/SQL/更新管理员.sql

@@ -0,0 +1,5 @@
+UPDATE tuser
+SET wechat_name=$wechat_name$,
+    wechat_mobile=$wechat_mobile$,
+    wechat_position=$wechat_position$
+WHERE tuserid = $tuserid$

+ 0 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/data/tadministrators/SQL/查询管理员列表.sql → src/dsb/com/cnd3b/restcontroller/enterprise/tadministrators/SQL/查询管理员列表.sql


+ 37 - 11
src/dsb/com/cnd3b/restcontroller/enterprise/data/tadministrators/tadministrators.java → src/dsb/com/cnd3b/restcontroller/enterprise/tadministrators/tadministrators.java

@@ -1,4 +1,4 @@
-package com.cnd3b.restcontroller.enterprise.data.tadministrators;
+package com.cnd3b.restcontroller.enterprise.tadministrators;
 
 import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
@@ -41,18 +41,33 @@ public class tadministrators extends Controller {
         int fispxxx = content.getIntValue("fispxxx");
         //资料管理权限
         int fiszl = content.getIntValue("fiszl");
+        String wechat_name = content.getString("wechat_name");
+        String wechat_mobile = content.getString("wechat_mobile");
+        String wechat_position = content.getString("wechat_position");
 
         //新增体系
-        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tadministrators");
-        PaoRemote paoRemote = paoSetRemote.addAtEnd();
-        paoRemote.setValue("tuserid", tuserid, 11L);
-        paoRemote.setValue("fpassword", fpassword, 11L);
-        paoRemote.setValue("fisagent", fisagent, 11L);
-        paoRemote.setValue("fissaler", fissaler, 11L);
-        paoRemote.setValue("fissysadministrator", fissysadministrator, 11L);
-        paoRemote.setValue("fispxxx", fispxxx, 11L);
-        paoRemote.setValue("fiszl", fiszl, 11L);
-        paoSetRemote.save();
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tadministrators", "tuserid = '" + tuserid + "'");
+        if (paoSetRemote.isEmpty()) {
+            PaoRemote paoRemote = paoSetRemote.addAtEnd();
+            paoRemote.setValue("tuserid", tuserid, 11L);
+            paoRemote.setValue("fpassword", fpassword, 11L);
+            paoRemote.setValue("fisagent", fisagent, 11L);
+            paoRemote.setValue("fissaler", fissaler, 11L);
+            paoRemote.setValue("fissysadministrator", fissysadministrator, 11L);
+            paoRemote.setValue("fispxxx", fispxxx, 11L);
+            paoRemote.setValue("fiszl", fiszl, 11L);
+            paoSetRemote.save();
+
+            SQLFactory sqlFactory = new SQLFactory(this, "更新管理员");
+            sqlFactory.addParameter("wechat_name", wechat_name);
+            sqlFactory.addParameter("wechat_mobile", wechat_mobile);
+            sqlFactory.addParameter("wechat_position", wechat_position);
+            sqlFactory.addParameter("tuserid", tuserid);
+            dbConnect.runSqlUpdate(sqlFactory.getSQL());
+
+        } else {
+            return getErrReturnObject().setErrMsg("该成员已添加").toString();
+        }
         return getSucReturnObject().toString();
     }
 
@@ -78,6 +93,10 @@ public class tadministrators extends Controller {
         //资料管理权限
         int fiszl = content.getIntValue("fiszl");
 
+        String wechat_name = content.getString("wechat_name");
+        String wechat_mobile = content.getString("wechat_mobile");
+        String wechat_position = content.getString("wechat_position");
+
         //新增体系
         PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tadministrators", "tadministratorsid = '" + tadministratorsid + "'");
         if (!paoSetRemote.isEmpty()) {
@@ -90,6 +109,13 @@ public class tadministrators extends Controller {
             paoRemote.setValue("fispxxx", fispxxx, 11L);
             paoRemote.setValue("fiszl", fiszl, 11L);
             paoSetRemote.save();
+
+            SQLFactory sqlFactory = new SQLFactory(this, "更新管理员");
+            sqlFactory.addParameter("wechat_name", wechat_name);
+            sqlFactory.addParameter("wechat_mobile", wechat_mobile);
+            sqlFactory.addParameter("wechat_position", wechat_position);
+            sqlFactory.addParameter("tuserid", tuserid);
+            dbConnect.runSqlUpdate(sqlFactory.getSQL());
         } else {
             return getErrReturnObject().setErrMsg("未找到更新记录").toString();
         }

+ 9 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/经销商档案详细.sql

@@ -0,0 +1,9 @@
+SELECT t1.tagentsid,
+       t1.createdate,
+       t1.fagentname,
+       t1.faddress,
+       t1.fcontact,
+       t1.fphonenumber,
+       t1.wechat_depid
+FROM tagents t1
+WHERE t1.tagentsid = $tagentsid$

+ 56 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -2,8 +2,12 @@ package com.cnd3b.restcontroller.enterprise.tagents;
 
 import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
+import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.SQLFactory;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
 
 public class tagents extends Controller {
     /**
@@ -29,5 +33,57 @@ public class tagents extends Controller {
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }
 
+    /**
+     * 查询经销商详细
+     *
+     * @return
+     */
+    public String selectTagentsDetail() {
+        String tagentsid = content.getString("tagentsid");
+        SQLFactory sqlFactory = new SQLFactory(this, "经销商档案详细");
+        sqlFactory.addParameter("tagentsid", tagentsid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        if (rows.isEmpty()) {
+            return getErrReturnObject().setErrMsg("未查询经销商详细").toString();
+        }
+        Row row = rows.get(0);
+
+        String sql = "SELECT tagentauthid,tagentsid,fauthtype FROM tagentauth WHERE tagentsid='" + tagentsid + "'";
+        Rows tauthRows = dbConnect.runSqlQuery(sql);
+
+        row.put("tagentauth", tauthRows);
+        return getSucReturnObject().setData(row).toString();
+    }
+
+
+    /**
+     * 更新经销商
+     *
+     * @return
+     */
+    public String updateTagents() throws P2Exception {
+
+        String tagentsid = content.getString("tagentsid");
+        String fagentname = content.getString("fagentname");
+        String faddress = content.getString("faddress");
+        String fcontact = content.getString("fcontact");
+        String fphonenumber = content.getString("fphonenumber");
+
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tagents", "tagentsid = '" + tagentsid + "'");
+        if (!paoSetRemote.isEmpty()) {
+            PaoRemote paoRemote = paoSetRemote.getPao(0);
+            paoRemote.setValue("fagentname", fagentname, 11L);
+            paoRemote.setValue("faddress", faddress, 11L);
+            paoRemote.setValue("fcontact", fcontact, 11L);
+            paoRemote.setValue("fphonenumber", fphonenumber, 11L);
+            paoSetRemote.save();
+        } else {
+            return getErrReturnObject().setErrMsg("未找到更新的数据").toString();
+        }
+
+
+        return getSucReturnObject().toString();
+    }
+
 
 }

+ 30 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tuser/tuser.java

@@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
 import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.SQLFactory;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
 
 public class tuser extends Controller {
     /**
@@ -28,4 +31,31 @@ public class tuser extends Controller {
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }
 
+    /**
+     * 更新经销商
+     *
+     * @return
+     */
+    public String updateTuser() throws P2Exception {
+
+        String tuserid = content.getString("tuserid");
+        String wechat_name = content.getString("wechat_name");
+        String wechat_mobile = content.getString("wechat_mobile");
+        String wechat_position = content.getString("wechat_position");
+
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tuser", "tuserid = '" + tuserid + "'");
+        if (!paoSetRemote.isEmpty()) {
+            PaoRemote paoRemote = paoSetRemote.getPao(0);
+            paoRemote.setValue("wechat_name", wechat_name, 11L);
+            paoRemote.setValue("wechat_mobile", wechat_mobile, 11L);
+            paoRemote.setValue("wechat_position", wechat_position, 11L);
+            paoSetRemote.save();
+        } else {
+            return getErrReturnObject().setErrMsg("未找到更新的数据").toString();
+        }
+
+
+        return getSucReturnObject().toString();
+    }
+
 }

+ 28 - 25
src/dsb/com/cnd3b/service/GetWechatData.java

@@ -100,13 +100,14 @@ public class GetWechatData extends BaseClass implements Runnable {
                 paoRemote.setValue("wechat_parendeptid", jsonObject.getIntValue("parentid"), 11L);
                 paoRemote.setValue("wechat_depname", jsonObject.getString("name"), 11L);
                 paoSetRemote.save();
-            } else {
-                PaoRemote paoRemote = paoSetRemote.getPao(0);
-                paoRemote.setValue("wechat_depid", id, 11L);
-                paoRemote.setValue("wechat_parendeptid", jsonObject.getIntValue("parentid"), 11L);
-                paoRemote.setValue("wechat_depname", jsonObject.getString("name"), 11L);
-                paoSetRemote.save();
             }
+//            else {
+//                PaoRemote paoRemote = paoSetRemote.getPao(0);
+//                paoRemote.setValue("wechat_depid", id, 11L);
+//                paoRemote.setValue("wechat_parendeptid", jsonObject.getIntValue("parentid"), 11L);
+//                paoRemote.setValue("wechat_depname", jsonObject.getString("name"), 11L);
+//                paoSetRemote.save();
+//            }
         }
 //        SQLFactory sqlFactory = new SQLFactory(this, "ɾ³ý΢ÐŲ¿ÃÅ");
 //        sqlFactory.addParameter_in("ids", ids);
@@ -155,18 +156,19 @@ public class GetWechatData extends BaseClass implements Runnable {
                 paoRemote.setValue("wechat_depid", wechat_depid, 11L);
                 paoRemote.setValue("fusertype", fusertype, 11L);
                 paoSetRemote.save();
-            } else {
-                PaoRemote paoRemote = paoSetRemote.getPao(0);
-                paoRemote.setValue("siteid", parameter.defaultsiteid, 11L);
-                paoRemote.setValue("wechat_userid", wechat_userid, 11L);
-                paoRemote.setValue("WECHAT_NAME", WECHAT_NAME, 11L);
-                paoRemote.setValue("wechat_open_userid", wechat_open_userid, 11L);
-                paoRemote.setValue("wechat_mobile", wechat_mobile, 11L);
-                paoRemote.setValue("wechat_position", wechat_position, 11L);
-                paoRemote.setValue("wechat_depid", wechat_depid, 11L);
-                paoRemote.setValue("fusertype", fusertype, 11L);
-                paoSetRemote.save();
             }
+//            else {
+//                PaoRemote paoRemote = paoSetRemote.getPao(0);
+//                paoRemote.setValue("siteid", parameter.defaultsiteid, 11L);
+//                paoRemote.setValue("wechat_userid", wechat_userid, 11L);
+//                paoRemote.setValue("WECHAT_NAME", WECHAT_NAME, 11L);
+//                paoRemote.setValue("wechat_open_userid", wechat_open_userid, 11L);
+//                paoRemote.setValue("wechat_mobile", wechat_mobile, 11L);
+//                paoRemote.setValue("wechat_position", wechat_position, 11L);
+//                paoRemote.setValue("wechat_depid", wechat_depid, 11L);
+//                paoRemote.setValue("fusertype", fusertype, 11L);
+//                paoSetRemote.save();
+//            }
 
 
         }
@@ -213,15 +215,16 @@ public class GetWechatData extends BaseClass implements Runnable {
                     paoRemote.setValue("fphonenumber", fphonenumber, 11L);
                     paoRemote.setValue("faddress", faddress, 11L);
                     paoSetRemote.save();
-                } else {
-                    PaoRemote paoRemote = paoSetRemote.getPao(0);
-                    paoRemote.setValue("wechat_depid", wechat_depid, 11L);
-                    paoRemote.setValue("fagentname", jsonObject.getString("name"), 11L);
-                    paoRemote.setValue("fcontact", fcontact, 11L);
-                    paoRemote.setValue("fphonenumber", fphonenumber, 11L);
-                    paoRemote.setValue("faddress", faddress, 11L);
-                    paoSetRemote.save();
                 }
+//                else {
+//                    PaoRemote paoRemote = paoSetRemote.getPao(0);
+//                    paoRemote.setValue("wechat_depid", wechat_depid, 11L);
+//                    paoRemote.setValue("fagentname", jsonObject.getString("name"), 11L);
+//                    paoRemote.setValue("fcontact", fcontact, 11L);
+//                    paoRemote.setValue("fphonenumber", fphonenumber, 11L);
+//                    paoRemote.setValue("faddress", faddress, 11L);
+//                    paoSetRemote.save();
+//                }
             }
         }
 

+ 2 - 2
src/dsb/com/cnd3b/utility/aliyun/oss/AliyunOSSConfigConstant.java

@@ -5,9 +5,9 @@ public class AliyunOSSConfigConstant {
     private AliyunOSSConfigConstant() {
     }
 
-    //仓库名称
+    //仓库名称-培训学习
     public static final String BUCKE_NAME = "jiusheng11";
-    //地域节点 我选的深圳
+    //地域节点
     public static final String END_POINT = "https://oss-cn-beijing.aliyuncs.com";
     //AccessKey ID 阿里云AccessKey
     public static final String AccessKey_ID = "LTAI5tASc17g95ABAqwUAqNS";

+ 77 - 0
src/dsb/com/cnd3b/utility/aliyun/oss/AliyunOSSUtil.java

@@ -1,4 +1,81 @@
 package com.cnd3b.utility.aliyun.oss;
 
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.oss.OSS;
+
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.*;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.cnd3b.utility.aliyun.oss.AliyunOSSConfigConstant.*;
+
 public class AliyunOSSUtil {
+
+    /**
+     * 设置每页列举文件数。
+     */
+    private int maxKeys = 200;
+    /**
+     * OSSClient实例。
+     */
+    private OSS ossClient;
+
+    public AliyunOSSUtil() {
+        if (ossClient == null) {
+            ossClient = new OSSClientBuilder().build(END_POINT, AccessKey_ID, AccessKey_Secret);
+        }
+
+    }
+
+
+    /**
+     * @param filePath   文件夹路径:分类1/
+     * @param nextMarker 分页标记
+     */
+    public void getFileList(String filePath, String nextMarker) {
+        // 构造ListObjectsRequest请求。
+        ListObjectsRequest listObjectsRequest = new ListObjectsRequest("js-data-1").withMarker(nextMarker).withMaxKeys(maxKeys);
+        // 设置正斜线(/)为文件夹的分隔符。
+        listObjectsRequest.setDelimiter("/");
+        // 列出fun目录下的所有文件和文件夹。
+        listObjectsRequest.setPrefix(filePath);
+
+        ObjectListing listing = ossClient.listObjects(listObjectsRequest);
+        nextMarker = listing.getNextMarker();
+        List<OSSObjectSummary> sums = listing.getObjectSummaries();
+        for (OSSObjectSummary s : sums) {
+            System.out.println("\t" + s.getKey());
+        }
+        //
+        // objectSummaries的列表中给出的是fun目录下的文件,遍历所有文件。
+        List<String> listObjectSummary = new ArrayList<>();
+        for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) {
+            listObjectSummary.add(objectSummary.getKey());
+            objectSummary.getSize();
+
+        }
+        //遍历所有commonPrefix, commonPrefixs列表中显示的是fun目录下的所有子文件夹。由于fun/movie/001.avi和fun/movie/007.avi属于fun文件夹下的movie目录,因此这两个文件未在列表中。
+        List<String> listCommonPrefix = new ArrayList<>();
+        for (String commonPrefix : listing.getCommonPrefixes()) {
+            listCommonPrefix.add(commonPrefix);
+        }
+        // 关闭OSSClient。
+        ossClient.shutdown();
+
+        JSONObject resObj = new JSONObject();
+        resObj.put("nextMarker", nextMarker);
+//        resObj.put("listObjectSummary", listObjectSummary);
+//        resObj.put("listCommonPrefix", listCommonPrefix);
+        resObj.put("list", listing);
+        System.out.println(resObj.toJSONString());
+    }
+
+    public static void main(String[] args) {
+        new AliyunOSSUtil().getFileList("分类10/", "");
+    }
+
+
 }

+ 10 - 0
src/dsb/com/cnd3b/utility/aliyun/oss/OSSBean.java

@@ -0,0 +1,10 @@
+package com.cnd3b.utility.aliyun.oss;
+
+public class OSSBean {
+
+//    private Long size;
+//    private String key;
+//    private
+
+
+}