吴志根 3 лет назад
Родитель
Сommit
422d0484bb

+ 5 - 4
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/分类.sql

@@ -3,7 +3,8 @@ from (
          SELECT t1.ttypedetailid,
                 t1.fvalue,
                 t1.ftype,
-                t1.fparentid
+                t1.fparentid,
+                t1.serialno
          FROM ttypedetail t1
          where t1.fparentid in (SELECT ttypedetailid FROM ttypedetail where fparentid = 1)
            and t1.fisused = 1
@@ -12,12 +13,12 @@ from (
          SELECT t1.ttypedetailid,
                 t1.fvalue,
                 t1.ftype,
-                t1.fparentid
+                t1.fparentid,
+                t1.serialno
          FROM ttypedetail t1
          WHERE t1.ttypedetailid in (SELECT ttypedetailid
                                     FROM ttypedetail_auth
                                     WHERE position in (SELECT wechat_position FROM tuser WHERE tuserid = $tuserid$))
-           and $where$
      ) a
 
-order by ttypedetailid desc
+order by serialno

+ 7 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/插入文件夹.sql

@@ -0,0 +1,7 @@
+if
+not exists (select 1 from tfolder where fpath = $fpath$)
+      insert into tfolder(tfolderid,rmkenable,createdate,fpath,tfilename) values($tfolderid$,0,GETDATE(), $fpath$,$fpath$)
+   else
+update tfolder
+set changedate = getdate()
+where fpath = $fpath$

+ 4 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/查询是否有授权.sql

@@ -0,0 +1,4 @@
+SELECT DISTINCT t2.fpath
+from tfolderauth t1
+         LEFT JOIN tfolder t2 ON t1.tfolderid = t2.tfolderid
+WHERE t2.fpath in $fpath$

+ 2 - 1
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/查询考试列表.sql

@@ -1,2 +1,3 @@
 SELECT *
-FROM texam t1
+FROM texam t1
+where $where$

+ 2 - 1
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/查询账号目录.sql

@@ -3,4 +3,5 @@ FROM tfolderauth t1
          LEFT JOIN tfolder t2 ON t1.tfolderid = t2.tfolderid
 WHERE frole IN $frole$
    OR fauthtype IN $fauthtype$
-   OR tuserid = $tuserid$
+   OR tuserid = $tuserid$
+   OR tdepartmentid =( SELECT tdepartmentid FROM tdepartment WHERE wechat_depid = ( SELECT wechat_parendeptid FROM tdepartment WHERE wechat_depid = ( SELECT wechat_depid FROM tuser WHERE tuserid = $tuserid$)))

+ 33 - 21
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -3,10 +3,7 @@ package com.cnd3b.restcontroller.customer.wechatapplet;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyun.oss.HttpMethod;
-import com.aliyun.oss.model.GeneratePresignedUrlRequest;
-import com.aliyun.oss.model.ListObjectsRequest;
-import com.aliyun.oss.model.OSSObjectSummary;
-import com.aliyun.oss.model.ObjectListing;
+import com.aliyun.oss.model.*;
 import com.cnd3b.common.Controller;
 import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
@@ -19,6 +16,7 @@ import p2.common.parse.S;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.pao.R;
+import p2.pao.SqlFormat;
 import p2.util.P2Exception;
 
 import java.net.URI;
@@ -71,6 +69,7 @@ public class wechatapplet extends Controller {
         sqlFactory.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
 
+
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }
 
@@ -178,9 +177,9 @@ public class wechatapplet extends Controller {
         String where = "";
         //1表示业务员
         if (fusertype.equals("1")) {
-            where = "t1.fissaler ='1'";
+            where = "t1.fispublic in (0,2)";
         } else {
-            where = "t1.fisagent ='1'";
+            where = "t1.fispublic in (0,1) and  t1.fisagent=0 ";
         }
 
         SQLFactory sqlFactory = new SQLFactory(this, "分类");
@@ -253,6 +252,10 @@ public class wechatapplet extends Controller {
         ArrayList<String> keyStr = new ArrayList<>();
         for (JSONObject object : listFolder) {
             keyStr.add(object.getString("folderpath"));
+            SQLFactory sqlFactory = new SQLFactory(this, "插入文件夹");
+            sqlFactory.addParameter("fpath", object.getString("folderpath"));
+            sqlFactory.addParameter("tfolderid", createTableID("tfolder", "tfolderid"));
+            dbConnect.runSqlUpdate(sqlFactory);
         }
         SQLFactory sqlNameFac = new SQLFactory(this, "查询文件名称");
         sqlNameFac.addParameter_in("fpath", keyStr);
@@ -718,16 +721,24 @@ public class wechatapplet extends Controller {
     }
 
     public ArrayList<JSONObject> getListFolder(ArrayList<JSONObject> listFolderAll, ArrayList<String> listUserFolders) {
+        ArrayList<String> fpathList = new ArrayList<>();
+        for (JSONObject object : listFolderAll) {
+            fpathList.add(object.getString("folderpath"));
+        }
+        SQLFactory sqlFactory = new SQLFactory(this, "查询是否有授权");
+        sqlFactory.addParameter_in("fpath", fpathList);
+        String sql = sqlFactory.getSQL();
+        Rows rows = dbConnect.runSqlQuery(sql);
+        if (rows.isEmpty()) {
+            return listFolderAll;
+        }
+
         ArrayList<JSONObject> listFolder = new ArrayList<>();
         for (JSONObject object : listFolderAll) {
             String folderpath = object.getString("folderpath");
-            if (listUserFolders.size() == 0) {
-                listFolder.add(object);
-            } else {
-                for (String str : listUserFolders) {
-                    if (str.equals(folderpath)) {
-                        listFolder.add(object);
-                    }
+            for (String str : listUserFolders) {
+                if (str.equals(folderpath)) {
+                    listFolder.add(object);
                 }
             }
         }
@@ -735,16 +746,17 @@ public class wechatapplet extends Controller {
     }
 
     public ArrayList<JSONObject> getListFolder(ObjectListing listing, ArrayList<String> listUserFolders, ArrayList<String> listRole, ArrayList<String> listfauthtype) {
+        //查询oss上的文件夹目录
         ArrayList<JSONObject> listFolderAll = getListFolderAll(listing);
         ArrayList<JSONObject> listFolder = getListFolder(listFolderAll, listUserFolders);
-        if (listFolder.size() == 0) {
-            listFolder = listFolderAll;
-        } else {
-            if (fusertype.equals("经销商")) {
-                //开启双向验证
-                listFolder = check(listFolder, listRole, listfauthtype);
-            }
-        }
+//        if (listFolder.size() == 0) {
+//            listFolder = listFolderAll;
+//        } else {
+////            if (fusertype.equals("经销商")) {
+////                //开启双向验证
+////                listFolder = check(listFolder, listRole, listfauthtype);
+////            }
+//        }
         return listFolder;
     }
 

+ 1 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/texam/SQL/查询考试列表.sql

@@ -1,2 +1,3 @@
 SELECT *
 FROM texam t1
+where $where$

+ 1 - 1
src/dsb/com/cnd3b/restcontroller/enterprise/tposition/tposition.java

@@ -25,7 +25,7 @@ public class tposition extends Controller {
 
         PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tposition");
         PaoRemote paoRemote = paoSetRemote.addAtEnd();
-        paoRemote.setValue("tpositionid", paoRemote.getUniqueIDValue(), 11L);
+        paoRemote.setValue("tpositionid", createTableID("tposition", "tpositionid"), 11L);
         paoRemote.setValue("fname", fname, 11L);
         paoRemote.setValue("ftype", ftype, 11L);
         paoSetRemote.save();

+ 5 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/ttypedetail/SQL/查询子资料分类列表.sql

@@ -4,7 +4,10 @@ SELECT t1.ttypedetailid,
        t1.fisused,
        t1.fparentid,
        t1.fissaler,
-       t1.fisagent
+       t1.fisagent,
+       t1.fispublic,
+       t1.serialno
 FROM ttypedetail t1
 where t1.fparentid = $fparentid$
-  and $where$
+  and $where$
+

+ 4 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/ttypedetail/SQL/查询资料分类列表.sql

@@ -4,6 +4,8 @@ SELECT t1.ttypedetailid,
        t1.fisused,
        t1.fparentid,
        t1.fissaler,
-       t1.fisagent
+       t1.fisagent,
+       t1.fispublic,
+       t1.serialno
 FROM ttypedetail t1
-where $where$
+where $where$

+ 11 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/ttypedetail/ttypedetail.java

@@ -7,6 +7,7 @@ import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.pao.SqlFormat;
@@ -43,6 +44,8 @@ public class ttypedetail extends Controller {
         String fissaler = content.getString("fissaler");
         //经销商可见
         String fisagent = content.getString("fisagent");
+        long fispublic = content.getLong("fispublic");
+        long serialno = content.getLong("serialno");
         JSONArray positions = content.getJSONArray("positions");
 
         PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("ttypedetail");
@@ -55,6 +58,8 @@ public class ttypedetail extends Controller {
         paoRemote.setValue("fparentid", fparentid, 11L);
         paoRemote.setValue("fissaler", fissaler, 11L);
         paoRemote.setValue("fisagent", fisagent, 11L);
+        paoRemote.setValue("fispublic", fispublic, 11L);
+        paoRemote.setValue("serialno", serialno, 11L);
         paoSetRemote.save();
 
         for (Object position : positions) {
@@ -90,6 +95,8 @@ public class ttypedetail extends Controller {
         //经销商可见
         String fisagent = content.getString("fisagent");
         JSONArray positions = content.getJSONArray("positions");
+        long fispublic = content.getLong("fispublic");
+        long serialno = content.getLong("serialno");
 
         PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("ttypedetail", "ttypedetailid = '" + ttypedetailid + "'");
         if (!paoSetRemote.isEmpty()) {
@@ -100,6 +107,8 @@ public class ttypedetail extends Controller {
             paoRemote.setValue("fparentid", fparentid, 11L);
             paoRemote.setValue("fissaler", fissaler, 11L);
             paoRemote.setValue("fisagent", fisagent, 11L);
+            paoRemote.setValue("fispublic", fispublic, 11L);
+            paoRemote.setValue("serialno", serialno, 11L);
             paoSetRemote.save();
         } else {
             return getErrReturnObject().setErrMsg("未找到更新的数据").toString();
@@ -172,10 +181,10 @@ public class ttypedetail extends Controller {
         String fparentid = content.getString("fparentid");
         SQLFactory sqlFactory = null;
         if (fparentid.equals("") || fparentid == null) {
-            sqlFactory = new SQLFactory(this, "查询资料分类列表", pageSize, pageNumber, "t1.ttypedetailid desc");
+            sqlFactory = new SQLFactory(this, "查询资料分类列表", pageSize, pageNumber, "t1.serialno");
             sqlFactory.addParameter_SQL("where", where);
         } else {
-            sqlFactory = new SQLFactory(this, "查询子资料分类列表", pageSize, pageNumber, "t1.ttypedetailid desc");
+            sqlFactory = new SQLFactory(this, "查询子资料分类列表", pageSize, pageNumber, "t1.serialno");
             sqlFactory.addParameter("fparentid", fparentid);
             sqlFactory.addParameter_SQL("where", where);
         }