吴志根 преди 4 години
родител
ревизия
a2128f380b

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

@@ -32,5 +32,5 @@ select t1.siteid
      , t1.contentlength
      , t1.contentlength
 from tattachment t1
 from tattachment t1
 where t1.ownertable = 'tarchives_sc'
 where t1.ownertable = 'tarchives_sc'
-  and t1.ownerid in ('402')
+  and t1.ownerid in  $ownerid$
 order by t1.tattachmentid
 order by t1.tattachmentid

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

@@ -32,6 +32,6 @@ select t1.siteid
      , t1.contentlength
      , t1.contentlength
 from tattachment t1
 from tattachment t1
 where t1.ownertable = 'tarchives_sc'
 where t1.ownertable = 'tarchives_sc'
-  and t1.ownerid in ('402')
+  and t1.ownerid in  $ownerid$
   and t1.ftype = $ftype$
   and t1.ftype = $ftype$
 order by t1.tattachmentid
 order by t1.tattachmentid

+ 7 - 0
src/dsb/com/cnd3b/common/restful/WebClientRest.java

@@ -88,6 +88,13 @@ public class WebClientRest {
                 return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("账号不存在,请重新登录").toString();
                 return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("账号不存在,请重新登录").toString();
             }
             }
             tuserid = requestcontent.getString("tuserid");
             tuserid = requestcontent.getString("tuserid");
+            DBConnect dbConnect = new DBConnect();
+            String sql = "SELECT*FROM tuser WHERE tuserid='" + tuserid + "'";
+            Rows rows = dbConnect.runSqlQuery(sql);
+            if (rows.isEmpty()) {
+                return new D3BReturnObject_Err().setErrCode(-1).setErrMsg("账号不存在,请重新登录").toString();
+            }
+
 //            /**
 //            /**
 //             * 盘点当前账号是否存在有效的token
 //             * 盘点当前账号是否存在有效的token
 //             */
 //             */

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

@@ -8,4 +8,5 @@ SELECT t1.tarchives_scid,
        t1.fiscandownload
        t1.fiscandownload
 FROM tarchives_sc t1
 FROM tarchives_sc t1
 WHERE t1.ttypedetailid = $ttypedetailid$
 WHERE t1.ttypedetailid = $ttypedetailid$
-  and t1.fstatus = '·¢²¼'
+  and t1.fstatus = '·¢²¼'
+  and (t1.fnotes LIKE $keywords$ OR t1.ftitle LIKE $keywords$)

+ 11 - 28
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -27,31 +27,6 @@ public class wechatapplet extends Controller {
         super(content);
         super(content);
     }
     }
 
 
-//    public String wechatappletLogin() {
-//        String code = content.getString("code");
-//        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);
-//        int errcode = object.getIntValue("errcode");
-//        String errmsg = object.getString("errmsg");
-//        if (errcode != 0) {
-//            return getErrReturnObject().setErrMsg(errmsg).toString();
-//        }
-//        String userid = object.getString("UserId");
-//        SQLFactory sqlFactory = new SQLFactory(this, "查询账号");
-//        sqlFactory.addParameter("wechat_userid", userid);
-//        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
-//        for (Row row : rows) {
-//            row.put("logintime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()));
-//        }
-//        if (rows.isEmpty()) {
-//            return getErrReturnObject().setErrMsg("未找到用户信息").toString();
-//        }
-//
-//        return getSucReturnObject().setData(rows).toString();
-//    }
 
 
     /**
     /**
      * 获取培训学习列表
      * 获取培训学习列表
@@ -62,17 +37,25 @@ public class wechatapplet extends Controller {
 
 
         String ttypedetailid = content.getString("ttypedetailid");
         String ttypedetailid = content.getString("ttypedetailid");
 
 
+        String keywords = "";
+        if (content.containsKey("keywords")) {
+            keywords = content.getString("keywords");
+        }
+
         SQLFactory sqlFactory = new SQLFactory(this, "查询课件列表", pageSize, pageNumber, " t1.createdate desc");
         SQLFactory sqlFactory = new SQLFactory(this, "查询课件列表", pageSize, pageNumber, " t1.createdate desc");
         sqlFactory.addParameter("ttypedetailid", ttypedetailid);
         sqlFactory.addParameter("ttypedetailid", ttypedetailid);
+        sqlFactory.addParameter("keywords", "%" + keywords + "%");
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
-        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"));
+//        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "video");
         //查询封面
         //查询封面
         RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
         RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
         for (Row row : rows) {
         for (Row row : rows) {
-            row.put("attinfos", rowsMap.get(row.getString("tarchives_scid")));
+//            row.put("attinfos", rowsMap.get(row.getString("tarchives_scid")));
             Rows coverRows = rowsMapCover.get(row.getString("tarchives_scid"));
             Rows coverRows = rowsMapCover.get(row.getString("tarchives_scid"));
             if (!coverRows.isEmpty()) {
             if (!coverRows.isEmpty()) {
                 row.put("cover", coverRows.get(0).getString("fobsurl"));
                 row.put("cover", coverRows.get(0).getString("fobsurl"));
+            } else {
+                row.put("cover", "");
             }
             }
 
 
         }
         }
@@ -94,7 +77,7 @@ public class wechatapplet extends Controller {
         SQLFactory sqlFactory = new SQLFactory(this, "查询课件详细");
         SQLFactory sqlFactory = new SQLFactory(this, "查询课件详细");
         sqlFactory.addParameter("tarchives_scid", tarchives_scid);
         sqlFactory.addParameter("tarchives_scid", tarchives_scid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
-        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"));
+        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "video");
         //查询封面
         //查询封面
         RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
         RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
         for (Row row : rows) {
         for (Row row : rows) {

+ 5 - 8
src/dsb/com/cnd3b/restcontroller/system/system/OSSManage.java

@@ -6,6 +6,7 @@ import com.aliyun.oss.OSSClientBuilder;
 import com.aliyun.oss.model.*;
 import com.aliyun.oss.model.*;
 import com.cnd3b.common.Controller;
 import com.cnd3b.common.Controller;
 import com.cnd3b.utility.FileTypeHelper;
 import com.cnd3b.utility.FileTypeHelper;
+import com.cnd3b.utility.aliyun.oss.AliyunOSSConfigConstant;
 import p2.pao.PaoRemote;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
 import p2.util.P2Exception;
@@ -17,11 +18,7 @@ import java.util.Date;
 
 
 public class OSSManage extends Controller {
 public class OSSManage extends Controller {
 
 
-    String endpoint = "https://oss-cn-beijing.aliyuncs.com";
     String file_url = "https://jiusheng11.oss-cn-beijing.aliyuncs.com";
     String file_url = "https://jiusheng11.oss-cn-beijing.aliyuncs.com";
-    String accessKeyID = "LTAI5tASc17g95ABAqwUAqNS";
-    String accessKeySecret = "UUs8gERP91X8HGeWgeOa6jsAIGQhhK";
-    String bucketName = "jiusheng11";
 
 
 
 
     /**
     /**
@@ -57,8 +54,8 @@ public class OSSManage extends Controller {
         } else {
         } else {
             key = ftype + "/" + filename;
             key = ftype + "/" + filename;
         }
         }
-        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyID, accessKeySecret);
-        ossClient.putObject(new PutObjectRequest(bucketName, key, file));
+        OSS ossClient = new OSSClientBuilder().build(AliyunOSSConfigConstant.END_POINT, AliyunOSSConfigConstant.AccessKey_ID, AliyunOSSConfigConstant.AccessKey_Secret);
+        ossClient.putObject(new PutObjectRequest(AliyunOSSConfigConstant.BUCKE_NAME, key, file));
         ossClient.shutdown();
         ossClient.shutdown();
         String url = file_url + "/" + key;
         String url = file_url + "/" + key;
 
 
@@ -114,8 +111,8 @@ public class OSSManage extends Controller {
         } else {
         } else {
             key = ftype + "/" + filename;
             key = ftype + "/" + filename;
         }
         }
-        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyID, accessKeySecret);
-        ossClient.putObject(new PutObjectRequest(bucketName, key, file));
+        OSS ossClient = new OSSClientBuilder().build(AliyunOSSConfigConstant.END_POINT, AliyunOSSConfigConstant.AccessKey_ID, AliyunOSSConfigConstant.AccessKey_Secret);
+        ossClient.putObject(new PutObjectRequest(AliyunOSSConfigConstant.BUCKE_NAME, key, file));
         ossClient.shutdown();
         ossClient.shutdown();
         String url = file_url + "/" + key;
         String url = file_url + "/" + key;
 
 

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

@@ -0,0 +1,18 @@
+package com.cnd3b.utility.aliyun.oss;
+
+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";
+    //Access Key Secret 阿里云Secret
+    public static final String AccessKey_Secret = "UUs8gERP91X8HGeWgeOa6jsAIGQhhK";
+
+
+}

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

@@ -0,0 +1,4 @@
+package com.cnd3b.utility.aliyun.oss;
+
+public class AliyunOSSUtil {
+}