| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- package com.cnd3b.restcontroller.publicmethod.live;
- 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 org.apache.ibatis.jdbc.SQL;
- public class live extends Controller {
- public live(JSONObject content) {
- super(content);
- }
- /**
- * 获取当前直播商户数
- *
- * @return
- */
- public String getLiveChannelData() {
- String tactivityid = content.getString("tactivityid");
- JSONObject resultObject = new JSONObject();
- //参展商
- SQLFactory agentcountSql = new SQLFactory(this, "活动直播间总数查询");
- agentcountSql.addParameter("tactivityid", tactivityid);
- Rows agentCountRows = agentcountSql.runSqlQuery();
- resultObject.put("fagentcount", agentCountRows.isEmpty() ? 0 : agentCountRows.get(0).getInteger("fcount"));
- //观众总人数
- SQLFactory custcountSql = new SQLFactory(this, "活动直播间观众总数查询");
- custcountSql.addParameter("tactivityid", tactivityid);
- Rows totalcustCountrows = custcountSql.runSqlQuery();
- resultObject.put("ftotalcustcount", totalcustCountrows.isEmpty() ? 0 : totalcustCountrows.get(0).getInteger("fcount"));
- SQLFactory livecustcount = new SQLFactory(this, "当前线上观众人数查询");
- livecustcount.addParameter("tactivityid", tactivityid);
- Rows liverows = dbConnect.runSqlQuery(livecustcount.getSQL());
- //正在直播数
- resultObject.put("flivecount", liverows.size());
- //当前在线观众人数
- resultObject.put("fcustcount", liverows.isEmpty() ? 0 : liverows.sum("fcount"));
- //直播列表
- resultObject.put("tlivelist", liverows);
- return getSucReturnObject().setData(resultObject).toString();
- }
- /**
- * 热门展商
- *
- * @return
- */
- public String agentList() {
- String tactivityid = content.getString("tactivityid");
- SQLFactory agentlistSql = new SQLFactory(this, "热门展商");
- agentlistSql.addParameter("tactivityid", tactivityid);
- Rows rows = agentlistSql.runSqlQuery();
- RowsMap map = getAttachmentUrl("tactivity_agentmsg", rows.toArrayList("tactivity_agentmsgid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("tactivity_agentmsgid")));
- }
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- /**
- * 热门展品
- *
- * @return
- */
- public String prodList() {
- String tactivityid = content.getString("tactivityid");
- SQLFactory agentlistSql = new SQLFactory(this, "热门展品");
- agentlistSql.addParameter("tactivityid", tactivityid);
- Rows rows = agentlistSql.runSqlQuery();
- RowsMap map = getAttachmentUrl("tactivity_agentmsg", rows.toArrayList("tactivity_agentmsgid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("tactivity_agentmsgid")));
- }
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- }
|