Sfoglia il codice sorgente

广告位管理及查询接口新增

沈静伟 4 anni fa
parent
commit
cd0a4bac45

+ 0 - 4
src/dsb/com/cnd3b/restcontroller/customer/live/live.java

@@ -132,7 +132,6 @@ public class live extends Controller {
         //观看人数(人)
         double viewers = getCount("观看人数", "num", channelid);
         resultObject.put("viewers", String.format("%.2f", viewers));
-        System.err.println(viewers);
         //人均观看次数(次)
         resultObject.put("viewCountsAvg", String.format("%.2f", viewers == 0.0 ? 0 : viewCounts / viewers));
         //人均观看时长(分钟)
@@ -154,7 +153,6 @@ public class live extends Controller {
         double duration = 0;
         PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tlive_sessiondata", "sessionid = '" + sessionid + "'");
         if (!paoSetRemote.isEmpty()) {
-            System.err.println(paoSetRemote.getCompleteWhere());
             PaoRemote paoRemote = paoSetRemote.getPao(0);
             //人数
             livepv = paoRemote.getDouble("livepv");
@@ -229,8 +227,6 @@ public class live extends Controller {
         String channelid = content.getString("channelid");
         SQLFactory sqlFactory = new SQLFactory(this, "直播场次列表查询", pageSize, pageNumber, "createdate");
         sqlFactory.addParameter("channelid", channelid);
-
-        System.err.println(sqlFactory.getSQL());
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }

+ 3 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/bannermag/SQL/轮播广告位查询.sql

@@ -0,0 +1,3 @@
+select tbannerlocationid, changeby,
+       changedate, fclienttype, flocation, fisused, fdimensional,
+       fnotes from tbannerlocation where siteid=$siteid$

+ 4 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/bannermag/SQL/轮播广告查询.sql

@@ -0,0 +1,4 @@
+select tbannermagid,tbannerlocationid, changeby,
+       changedate, fisused, fhyperlink, flinktype,
+       fdatatable, fdataid from tbannermag
+       where siteid=$siteid$ and tbannerlocationid in $tbannerlocationid$

+ 93 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/bannermag/bannermag.java

@@ -0,0 +1,93 @@
+package com.cnd3b.restcontroller.enterprise.bannermag;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import com.cnd3b.common.D3bException;
+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 p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+public class bannermag extends Controller {
+    public bannermag(JSONObject content) {
+        super(content);
+    }
+
+    /**
+     * 轮播位查询
+     *
+     * @return
+     */
+    public String query_bannerlocationlist() {
+        SQLFactory locationSQL = new SQLFactory(this, "轮播广告位查询");
+        locationSQL.addParameter("siteid", siteid);
+        Rows locationrows = dbConnect.runSqlQuery(locationSQL.getSQL());
+
+        SQLFactory bannerSQl = new SQLFactory(this, "轮播广告查询");
+        bannerSQl.addParameter("siteid", siteid);
+        bannerSQl.addParameter_in("tbannerlocationid", locationrows.toArrayList("tbannerlocationid"));
+        RowsMap bannermap = dbConnect.runSqlQuery(bannerSQl.getSQL()).toRowsMap("tbannerlocationid");
+        for (Row locationrow : locationrows) {
+            Rows bannerRows = bannermap.get(locationrow.getString("tbannerlocationid"));
+            for (Row bannerrow : bannerRows) {
+                bannerrow.put("attinfos", getAttachmentUrl("tbannerlocation", bannerrow.getString("tbannerlocationid")));
+            }
+            locationrow.put("banner", bannerRows);
+        }
+        return getSucReturnObject().setData(locationrows).saveToDataPool(10).toString();
+    }
+
+    /**
+     * 新增或修改轮播图
+     *
+     * @return
+     * @throws P2Exception
+     */
+    public String insertormodify_bannermag() throws D3bException, P2Exception {
+        long tbannerlocationid = content.getLong("tbannerlocationid");
+        long tbannermagid = content.getLong("tbannermagid");//新增传0
+        boolean fisused = content.getBooleanValue("fisused");
+        String fhyperlink = content.getString("fhyperlink", "tbannermag.fhyperlink", "广告链接URL");
+        String flinktype = content.getString("flinktype");
+        String fdatatable = content.getString("fdatatable");
+        long fdataid = content.getLongValue("fdataid");
+
+        PaoSetRemote tbannermagSet = getP2ServerSystemPaoSet("tbannermag", "siteid='" + siteid + "' and tbannermagid='" + tbannermagid + "'");
+        PaoRemote tbannermag = null;
+        if (tbannermagid <= 0 || tbannermagSet.isEmpty()) {
+            tbannermag = tbannermagSet.addAtEnd();
+            tbannermag.setValue("tbannerlocationid", tbannerlocationid, 11L);//企业ID
+            tbannermag.setValue("siteid", siteid, 11L);//企业ID
+            tbannermag.setValue("createby", username, 11L);//录入人
+            tbannermag.setValue("createdate", sysdate, 11L);//录入时间
+        } else {
+            tbannermag = tbannermagSet.getPao(0);
+        }
+        tbannermag.setValue("fisused", fisused, 11L);//是否启用
+        tbannermag.setValue("flinktype", flinktype, 11L);//链接类型
+        if ("DATA".equals(flinktype)) {
+            tbannermag.setValue("fdatatable", fdatatable, 11L);//公告内容
+            tbannermag.setValue("fdataid", fdataid, 11L);//是否私密
+        } else if ("URL".equals(flinktype)) {
+            tbannermag.setValue("fhyperlink", fhyperlink, 11L);//广告链接url
+        }
+        tbannermag.setValue("changeby", username, 11L);//修改人
+        tbannermag.setValue("changedate", sysdate, 11L);//修改时间
+        tbannermagSet.save();
+        return getSucReturnObject().toString();
+    }
+
+    public String delete_bannermag() throws P2Exception {
+        long tbannerlocationid = content.getLong("tbannerlocationid");
+        long tbannermagid = content.getLong("tbannermagid");//新增传0
+        String status = dbConnect.runSqlUpdate("delete from tbannermag where siteid='" + siteid + "' and tbannerlocationid='" + tbannerlocationid + "' and tbannermagid='" + tbannermagid + "'");
+        if ("true".equals(status)) {
+            return getSucReturnObject().toString();
+        } else {
+            return getErrReturnObject().setErrMsg(status).toString();
+        }
+    }
+}

+ 2 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/bannermag/SQL/轮播广告位查询.sql

@@ -0,0 +1,2 @@
+select tbannerlocationid, flocation, fisused
+from tbannerlocation where siteid=$siteid$ and fclienttype=$fclienttype$

+ 3 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/bannermag/SQL/轮播广告查询.sql

@@ -0,0 +1,3 @@
+select tbannermagid,tbannerlocationid,fhyperlink, flinktype,
+       fdatatable, fdataid from tbannermag
+       where siteid=$siteid$ and fisused=1 and tbannerlocationid in $tbannerlocationid$

+ 46 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/bannermag/bannermag.java

@@ -0,0 +1,46 @@
+package com.cnd3b.restcontroller.publicmethod.bannermag;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import com.cnd3b.common.D3bException;
+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 p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+public class bannermag extends Controller {
+    public bannermag(JSONObject content) {
+        super(content);
+    }
+
+    /**
+     * ÂÖ²¥Î»²éѯ
+     *
+     * @return
+     */
+    public String query_bannerlocationlist() {
+        String siteid = content.getString("siteid");
+        String fclienttype = content.getString("fclienttype");
+
+        SQLFactory locationSQL = new SQLFactory(this, "ÂÖ²¥¹ã¸æÎ»²éѯ");
+        locationSQL.addParameter("siteid", siteid);
+        locationSQL.addParameter("fclienttype", fclienttype);
+        Rows locationrows = dbConnect.runSqlQuery(locationSQL.getSQL());
+
+        SQLFactory bannerSQl = new SQLFactory(this, "ÂÖ²¥¹ã¸æ²éѯ");
+        bannerSQl.addParameter("siteid", siteid);
+        bannerSQl.addParameter_in("tbannerlocationid", locationrows.toArrayList("tbannerlocationid"));
+        RowsMap bannermap = dbConnect.runSqlQuery(bannerSQl.getSQL()).toRowsMap("tbannerlocationid");
+        for (Row locationrow : locationrows) {
+            Rows bannerRows = bannermap.get(locationrow.getString("tbannerlocationid"));
+            for (Row bannerrow : bannerRows) {
+                bannerrow.put("attinfos", getAttachmentUrl("tbannerlocation", bannerrow.getString("tbannerlocationid")));
+            }
+            locationrow.put("banner", bannerRows);
+        }
+        return getSucReturnObject().setData(locationrows).toString();
+    }
+}