| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- package com.cnd3b.restcontroller.publicmethod.homepage;
- import com.alibaba.fastjson.JSONArray;
- 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;
- public class homepage extends Controller {
- public homepage(JSONObject content) {
- super(content);
- }
- /**
- * 统计数据展示
- *
- * @return
- */
- public String getStatisticalData() {
- this.siteid = content.getString("siteid");
- SQLFactory sqlFactory = new SQLFactory(this, "统计数据展示");
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- /**
- * 供需分类选择查询
- *
- * @return
- */
- public String query_typeselectList() {
- this.siteid = content.getString("siteid");
- Rows rows = dbConnect.runSqlQuery("select ttypedetailid,fvalue as ftype from ttypedetail where ftype = '供需分类' and siteid ='" + siteid + "' and fisused=1 order by sequence");
- RowsMap map = getAttachmentUrl("ttypedetail", rows.toArrayList("ttypedetailid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("ttypedetailid")));
- }
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 供需列表查询
- *
- * @return
- */
- public String query_supplyanddemandList() {
- this.siteid = content.getString("siteid");
- /**
- *排序条件设置
- */
- String[] sortfield = {"t1.tsupplyanddemandid desc"};
- String sort = getSort(sortfield, "t1.tsupplyanddemandid desc");
- /**
- * 过滤条件设置
- */
- StringBuffer where = new StringBuffer(" 1=1 ");
- if (content.containsKey("where")) {
- JSONObject whereObject = content.getJSONObject("where");
- if (whereObject.containsKey("ftype") && !"".equals(whereObject.getString("ftype"))) {
- where.append(" and t1.ftype ='").append(whereObject.getString("ftype")).append("' ");
- }
- }
- SQLFactory sqlFactory = new SQLFactory(this, "供需列表查询", pageSize, pageNumber, sort);
- sqlFactory.addParameter("siteid", siteid);
- sqlFactory.addParameter_SQL("where", where);
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
- RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", rows.toArrayList("tsupplyanddemandid"));
- for (Row row : rows) {
- //附件信息
- row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
- }
- return getSucReturnObject().setDataByPaging(rows).saveToDataPool().toString();
- }
- /**
- * 供需详情查询
- *
- * @return
- */
- public String query_supplyanddemandMain() {
- this.siteid = content.getString("siteid");
- long tsupplyanddemandid = content.getLong("tsupplyanddemandid");
- long tagentsid = content.getLong("tagentsid");
- SQLFactory sqlFactory = new SQLFactory(this, "供需详情查询");
- sqlFactory.addParameter("siteid", siteid);
- sqlFactory.addParameter("tagentsid", tagentsid);
- sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
- RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", rows.toArrayList("tsupplyanddemandid"));
- for (Row row : rows) {
- //附件信息
- row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
- }
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 热门商户
- *
- * @return
- */
- public String agentList() {
- this.siteid = content.getString("siteid");
- SQLFactory agentlistSql = new SQLFactory(this, "优质商户", pageSize, pageNumber, "t1.tagentsid");
- agentlistSql.addParameter("saleprodclass", content.getString("saleprodclass"));
- Rows rows = agentlistSql.runSqlQuery();
- RowsMap map = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("tagentsid")));
- }
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- /**
- * 热门商户详情查询
- *
- * @return
- */
- public String agentsMain() {
- this.siteid = content.getString("siteid");
- SQLFactory sql = new SQLFactory(this, "优质商户详情", pageSize, pageNumber, "t1.tagents_productid");
- sql.addParameter("tagentsid", content.getString("tagentsid"));
- sql.addParameter("saleprodclass", content.getString("saleprodclass"));
- Rows rows = dbConnect.runSqlQuery(sql.getSQL());
- for (Row row : rows) {
- row.put("saleprodclass", JSONArray.parseArray(row.getString("saleprodclass")));
- row.put("attinfos", getAttachmentUrl("tagents", content.getString("tagentsid")));
- }
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 热门商品
- *
- * @return
- */
- public String prodList() {
- this.siteid = content.getString("siteid");
- SQLFactory agentlistSql = new SQLFactory(this, "优质商品");
- Rows rows = agentlistSql.runSqlQuery();
- RowsMap map = getAttachmentUrl("tagents_product", rows.toArrayList("tagents_productid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("tagents_productid")));
- }
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- }
|