吴志根 пре 4 година
родитељ
комит
42302443ef

+ 49 - 38
src/dsb/com/cnd3b/common/Controller.java

@@ -49,6 +49,8 @@ public class Controller extends BaseClass {
     public String hostipport;//访问地址url 如http://localhost:8080 http://127.0.0.1:8080
     public Date sysdate;
 
+    public String wechatID;
+
     /**
      * 构造函数
      *
@@ -101,6 +103,12 @@ public class Controller extends BaseClass {
         } else if ($classname.contains("publicmethod")) {
             siteid = (String) content.getOrDefault("siteid", parameter.defaultsiteid);
         }
+
+        if (this.content.containsKey("wechatID")) {
+            wechatID = content.getString("wechatID");
+//            System.err.println(wechatID);
+        }
+
     }
 
 
@@ -234,34 +242,34 @@ public class Controller extends BaseClass {
                     lastday = nowday;
                     userRequestLogMap.clear();
                 }
-//                System.err.println(userid);
-//                if (!userRequestLogMap.containsKey(userid)) {
-//                    Rows rows = dbConnect.runSqlQuery("select tuserrequestlogid from tuserrequestlog where siteid='" + siteid + "' and tenterprise_userid='" + userid + "' and convert(varchar(10),fdate,120)=convert(varchar(10),getdate(),120) ");
-//                    if (rows.isEmpty()) {
-//                        long tuserrequestlogid = createTableID("tuserrequestlog", "tuserrequestlogid");
-//                        SQLFactory sqlFactory = new SQLFactory(this, "请求日志插入");
-//                        sqlFactory.addParameter("tuserrequestlogid", tuserrequestlogid);
-//                        sqlFactory.addParameter("siteid", siteid);
-//                        sqlFactory.addParameter("tenterprise_userid", userid);
-//                        sqlFactory.addParameter("tagentsid", tagentsid);
-//                        String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
-//                        if ("true".equals(status)) {
-//                            userRequestLogMap.put(userid, tuserrequestlogid);
-//                        }
-//                    } else {
-//                        userRequestLogMap.put(userid, rows.get(0).getLong("tuserrequestlogid"));
-//                    }
-//                    userRequestLogcountMap.put(userid, 1L);
-//                } else {
-//                    long count = userRequestLogcountMap.get(userid) + 1;
-//                    if (count > 9) {
-//                        userRequestLogcountMap.put(userid, 1L);
-//                        long tuserrequestlogid = userRequestLogMap.get(userid);
-//                        dbConnect.runSqlUpdate("update tuserrequestlog set flastrequestdate=getdate(),frequesttimes=frequesttimes+" + count + " where siteid='" + siteid + "' and tenterprise_userid='" + userid + "' and tuserrequestlogid=" + tuserrequestlogid);
-//                    } else {
-//                        userRequestLogcountMap.put(userid, count);
-//                    }
-//                }
+                System.err.println(userid);
+                if (!userRequestLogMap.containsKey(userid)) {
+                    Rows rows = dbConnect.runSqlQuery("select tuserrequestlogid from tuserrequestlog where siteid='" + siteid + "' and tenterprise_userid='" + userid + "' and convert(varchar(10),fdate,120)=convert(varchar(10),getdate(),120) ");
+                    if (rows.isEmpty()) {
+                        long tuserrequestlogid = createTableID("tuserrequestlog", "tuserrequestlogid");
+                        SQLFactory sqlFactory = new SQLFactory(this, "请求日志插入");
+                        sqlFactory.addParameter("tuserrequestlogid", tuserrequestlogid);
+                        sqlFactory.addParameter("siteid", siteid);
+                        sqlFactory.addParameter("tenterprise_userid", userid);
+                        sqlFactory.addParameter("tagentsid", tagentsid);
+                        String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
+                        if ("true".equals(status)) {
+                            userRequestLogMap.put(userid, tuserrequestlogid);
+                        }
+                    } else {
+                        userRequestLogMap.put(userid, rows.get(0).getLong("tuserrequestlogid"));
+                    }
+                    userRequestLogcountMap.put(userid, 1L);
+                } else {
+                    long count = userRequestLogcountMap.get(userid) + 1;
+                    if (count > 9) {
+                        userRequestLogcountMap.put(userid, 1L);
+                        long tuserrequestlogid = userRequestLogMap.get(userid);
+                        dbConnect.runSqlUpdate("update tuserrequestlog set flastrequestdate=getdate(),frequesttimes=frequesttimes+" + count + " where siteid='" + siteid + "' and tenterprise_userid='" + userid + "' and tuserrequestlogid=" + tuserrequestlogid);
+                    } else {
+                        userRequestLogcountMap.put(userid, count);
+                    }
+                }
             }
         }.start();
     }
@@ -496,6 +504,8 @@ public class Controller extends BaseClass {
         docfactory.addParameter("siteid", siteid);
         docfactory.addParameter("ownertable", ownertable);
         docfactory.addParameter_in("ownerid", ownerids);
+        String sql = docfactory.getSQL();
+        System.err.println(sql);
         return dbConnect.runSqlQuery(docfactory.getSQL()).toRowsMap("ownerid");
     }
 
@@ -534,16 +544,16 @@ public class Controller extends BaseClass {
      */
     public String getHeadPic(long userid) {
 //        if (!headPicMap.containsKey(userid)) {
-            Rows rows = getAttachmentUrl("tenterprise_users", String.valueOf(userid), "headportrait");
-            if (!rows.isEmpty()) {
-                System.err.println(rows.get(0).getString("fobsurl_thumbnail"));
-                if(rows.get(0).getString("fobsurl_thumbnail").equals("")){
-                    headPicMap.put(userid, rows.get(0).getString("fobsurl"));
-                }else{
-                    headPicMap.put(userid, rows.get(0).getString("fobsurl_thumbnail"));
-                }
-
+        Rows rows = getAttachmentUrl("tenterprise_users", String.valueOf(userid), "headportrait");
+        if (!rows.isEmpty()) {
+            System.err.println(rows.get(0).getString("fobsurl_thumbnail"));
+            if (rows.get(0).getString("fobsurl_thumbnail").equals("")) {
+                headPicMap.put(userid, rows.get(0).getString("fobsurl"));
+            } else {
+                headPicMap.put(userid, rows.get(0).getString("fobsurl_thumbnail"));
             }
+
+        }
 //        }
         return headPicMap.getOrDefault(userid, "");
     }
@@ -668,7 +678,7 @@ public class Controller extends BaseClass {
     /**
      * 通知前端执行指定方法
      */
-    public void sendSystemWebSocketMessage(String classname, String method,long userid) {
+    public void sendSystemWebSocketMessage(String classname, String method, long userid) {
         if (parameter.websocketClients.containsKey(userid)) {
             JSONObject methodobject = new JSONObject();
             methodobject.put("type", "callmethod");
@@ -679,6 +689,7 @@ public class Controller extends BaseClass {
             }
         }
     }
+
     /**
      * 通知前端执行指定方法
      */

+ 23 - 7
src/dsb/com/cnd3b/common/data/SQL/附件查询.sql

@@ -1,3 +1,24 @@
+-- select t1.siteid
+--      , t1.ownerid
+--      , t1.ownertable
+--      , t1.ftype
+--      , t1.fdocument
+--      , t1.tattachmentid
+--      , t1.postfix
+--      , t1.serialnumber
+--      , t1.fobsurl
+--      , t2.fobsurl as fobsurl_thumbnail
+--      , t3.fobsurl as fobsurl_compressed
+--      , t4.fobsurl as fobsurl_hls
+--      , t1.createdate
+--      , t1.contentlength
+-- from tattachment t1
+-- left join tattachment t2 on t1.siteid=t2.siteid and t1.tattachmentid=t2.fparentid
+-- left join tattachment t3 on t1.siteid=t3.siteid and t1.tattachmentid=t3.fparentid
+-- left join tattachment t4 on t1.siteid=t4.siteid and t1.tattachmentid=t4.fparentid
+-- where t1.ownertable =$ownertable$ and t1.siteid=$siteid$ and t1.ownerid in $ownerid$ and isnull(t1.fparentid,0)=0
+-- order by t1.tattachmentid
+
 select t1.siteid
      , t1.ownerid
      , t1.ownertable
@@ -7,14 +28,9 @@ select t1.siteid
      , t1.postfix
      , t1.serialnumber
      , t1.fobsurl
-     , t2.fobsurl as fobsurl_thumbnail
-     , t3.fobsurl as fobsurl_compressed
-     , t4.fobsurl as fobsurl_hls
      , t1.createdate
      , t1.contentlength
 from tattachment t1
-left join tattachment t2 on t1.siteid=t2.siteid and t1.tattachmentid=t2.fparentid and t2.ftype='thumbnail'
-left join tattachment t3 on t1.siteid=t3.siteid and t1.tattachmentid=t3.fparentid and t3.ftype='compressed'
-left join tattachment t4 on t1.siteid=t4.siteid and t1.tattachmentid=t4.fparentid and t4.ftype='hls'
-where t1.ownertable =$ownertable$ and t1.siteid=$siteid$ and t1.ownerid in $ownerid$ and isnull(t1.fparentid,0)=0
+where t1.ownertable = 'tarchives_sc'
+  and t1.ownerid in ('402')
 order by t1.tattachmentid

+ 24 - 7
src/dsb/com/cnd3b/common/data/SQL/附件查询_类型.sql

@@ -1,3 +1,24 @@
+-- select t1.siteid
+--      , t1.ownerid
+--      , t1.ownertable
+--      , t1.ftype
+--      , t1.fdocument
+--      , t1.tattachmentid
+--      , t1.postfix
+--      , t1.serialnumber
+--      , t1.fobsurl
+--      , t2.fobsurl as fobsurl_thumbnail
+--      , t3.fobsurl as fobsurl_compressed
+--      , t4.fobsurl as fobsurl_hls
+--      , t1.createdate
+--      , t1.contentlength
+-- from tattachment t1
+-- left join tattachment t2 on t1.siteid=t2.siteid and t1.tattachmentid=t2.fparentid and t2.ftype='thumbnail'
+-- left join tattachment t3 on t1.siteid=t3.siteid and t1.tattachmentid=t3.fparentid and t3.ftype='compressed'
+-- left join tattachment t4 on t1.siteid=t4.siteid and t1.tattachmentid=t4.fparentid and t4.ftype='hls'
+-- where t1.ownertable =$ownertable$ and t1.ftype=$ftype$ and t1.siteid=$siteid$ and t1.ownerid in $ownerid$ and isnull(t1.fparentid,0)=0
+-- order by t1.tattachmentid
+
 select t1.siteid
      , t1.ownerid
      , t1.ownertable
@@ -7,14 +28,10 @@ select t1.siteid
      , t1.postfix
      , t1.serialnumber
      , t1.fobsurl
-     , t2.fobsurl as fobsurl_thumbnail
-     , t3.fobsurl as fobsurl_compressed
-     , t4.fobsurl as fobsurl_hls
      , t1.createdate
      , t1.contentlength
 from tattachment t1
-left join tattachment t2 on t1.siteid=t2.siteid and t1.tattachmentid=t2.fparentid and t2.ftype='thumbnail'
-left join tattachment t3 on t1.siteid=t3.siteid and t1.tattachmentid=t3.fparentid and t3.ftype='compressed'
-left join tattachment t4 on t1.siteid=t4.siteid and t1.tattachmentid=t4.fparentid and t4.ftype='hls'
-where t1.ownertable =$ownertable$ and t1.ftype=$ftype$ and t1.siteid=$siteid$ and t1.ownerid in $ownerid$ and isnull(t1.fparentid,0)=0
+where t1.ownertable = 'tarchives_sc'
+  and t1.ownerid in ('402')
+  and t1.ftype = $ftype$
 order by t1.tattachmentid

+ 11 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/查询课件列表.sql

@@ -0,0 +1,11 @@
+SELECT t1.tarchives_scid,
+       t1.ttypedetailid,
+       t1.createdate,
+       t1.fnotes,
+       t1.ftitle,
+       t1.fvisitors,
+       t1.fisontop,
+       t1.fiscandownload
+FROM tarchives_sc t1
+WHERE t1.ttypedetailid = $ttypedetailid$
+  and t1.fstatus = '·¢²¼'

+ 30 - 3
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -4,6 +4,7 @@ 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.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.parameter.parameter;
 import com.cnd3b.utility.WebRequest;
@@ -24,11 +25,11 @@ public class wechatapplet extends Controller {
 
     public String wechatappletLogin() {
         String code = content.getString("code");
-        String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=" + WechatDock_Enterprise.getAccessToken() + "&code=" + code;
-        System.err.println(url);
+        String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=" + WechatDock_Enterprise.getAccessToken2() + "&code=" + code;
+//        System.err.println(url);
         String response = new WebRequest().doGet(url);
         JSONObject object = JSONObject.parseObject(response);
-        System.err.println(object);
+//        System.err.println(object);
         int errcode = object.getIntValue("errcode");
         String errmsg = object.getString("errmsg");
         if (errcode != 0) {
@@ -48,4 +49,30 @@ public class wechatapplet extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+    /**
+     * 获取培训学习列表
+     *
+     * @return
+     */
+    public String getCoursewareList() {
+
+        String ttypedetailid = content.getString("ttypedetailid");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "查询课件列表", pageSize, pageNumber, " t1.createdate desc");
+        sqlFactory.addParameter("ttypedetailid", ttypedetailid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"));
+        //查询封面
+        RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
+        for (Row row : rows) {
+            row.put("attinfos", rowsMap.get(row.getString("tarchives_scid")));
+            Rows coverRows = rowsMapCover.get(row.getString("tarchives_scid"));
+            if (!coverRows.isEmpty()) {
+                row.put("cover", coverRows.get(0).getString("fobsurl"));
+            }
+
+        }
+        return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
+    }
+
 }

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

@@ -47,6 +47,7 @@ public class ttypedetail extends Controller {
         paoRemote.setValue("fissaler", fissaler, 11L);
         paoRemote.setValue("fisagent", fisagent, 11L);
         paoSetRemote.save();
+        System.err.println(wechatID);
         return getSucReturnObject().toString();
     }
 

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

@@ -108,9 +108,9 @@ public class GetWechatData extends BaseClass implements Runnable {
                 paoSetRemote.save();
             }
         }
-        SQLFactory sqlFactory = new SQLFactory(this, "删除微信部门");
-        sqlFactory.addParameter_in("ids", ids);
-        new DBConnect().runSqlUpdate(sqlFactory.getSQL());
+//        SQLFactory sqlFactory = new SQLFactory(this, "删除微信部门");
+//        sqlFactory.addParameter_in("ids", ids);
+//        new DBConnect().runSqlUpdate(sqlFactory.getSQL());
     }
 
     public void updateUser(JSONArray userArray) throws P2Exception {
@@ -170,9 +170,9 @@ public class GetWechatData extends BaseClass implements Runnable {
 
 
         }
-        SQLFactory sqlFactory = new SQLFactory(this, "删除微信部门成员");
-        sqlFactory.addParameter_in("ids", ids);
-        dbConnect.runSqlUpdate(sqlFactory.getSQL());
+//        SQLFactory sqlFactory = new SQLFactory(this, "删除微信部门成员");
+//        sqlFactory.addParameter_in("ids", ids);
+//        dbConnect.runSqlUpdate(sqlFactory.getSQL());
     }
 
 
@@ -225,9 +225,9 @@ public class GetWechatData extends BaseClass implements Runnable {
             }
         }
 
-        SQLFactory sqlFactory = new SQLFactory(this, "删除经销商");
-        sqlFactory.addParameter_in("ids", ids);
-        dbConnect.runSqlUpdate(sqlFactory.getSQL());
+//        SQLFactory sqlFactory = new SQLFactory(this, "删除经销商");
+//        sqlFactory.addParameter_in("ids", ids);
+//        dbConnect.runSqlUpdate(sqlFactory.getSQL());
     }
 
 }