瀏覽代碼

新增优质商户查询接口
所有公共接口新增siteid字段

沈静伟 4 年之前
父節點
當前提交
bb361d5b74

+ 1 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/优质商品.sql

@@ -0,0 +1 @@
+select t1.tagents_productid,t1.tagentsid,t1.fintroduction,t1.fprodname,t1.fprodclassname from tagents_product t1

+ 1 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/优质商户.sql

@@ -0,0 +1 @@
+select t1.tagentsid,t1.saleprodclass,t1.fbrand,t1.fagentname from tagents t1

+ 3 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/优质商户详情.sql

@@ -0,0 +1,3 @@
+select t1.fbrand, t1.fcontact, t1.faddress, t1.siteid, t1.fphonenumber, t1.fdutyparagraph, t1.saleprodclass,t1.fintroduction,t1.fagentname
+from tagents AS t1
+  and t1.tagentsid = $tagentsid$

+ 0 - 2
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/热门展品.sql

@@ -1,2 +0,0 @@
-select t1.tactivity_agentproductsid,t2.tagents_productid,t1.tagentsid,t1.fintroduction,t2.fprodname,t2.fprodclassname from tactivity_agentproducts t1
-inner join tagents_product t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid and t1.tagents_productid=t2.tagents_productid

+ 0 - 1
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/热门展商.sql

@@ -1 +0,0 @@
-select t1.tactivity_agentmsgid,t1.tagentsid,t1.flocationclass,t1.flocation,t1.fbrand,t1.fintroduction from tactivity_agentmsg t1

+ 31 - 8
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/homepage.java

@@ -1,5 +1,6 @@
 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;
@@ -18,6 +19,7 @@ public class homepage extends Controller {
      * @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();
@@ -30,7 +32,8 @@ public class homepage extends Controller {
      * @return
      */
     public String query_typeselectList() {
-        Rows rows = dbConnect.runSqlQuery("select ttypedetailid,fvalue as ftype from ttypedetail where ftype = '供需分类' and siteid ='BWJ' and fisused=1 order by sequence");
+        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")));
@@ -44,6 +47,7 @@ public class homepage extends Controller {
      * @return
      */
     public String query_supplyanddemandList() {
+        this.siteid = content.getString("siteid");
         /**
          *排序条件设置
          */
@@ -60,7 +64,7 @@ public class homepage extends Controller {
             }
         }
         SQLFactory sqlFactory = new SQLFactory(this, "供需列表查询", pageSize, pageNumber, sort);
-        sqlFactory.addParameter("siteid", "BWJ");
+        sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter_SQL("where", where);
 
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
@@ -78,11 +82,12 @@ public class homepage extends Controller {
      * @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", "BWJ");
+        sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("tagentsid", tagentsid);
         sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
@@ -94,29 +99,47 @@ public class homepage extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
-
     /**
      * 热门商户
      *
      * @return
      */
     public String agentList() {
-        SQLFactory agentlistSql = new SQLFactory(this, "热门展商");
+        this.siteid = content.getString("siteid");
+        SQLFactory agentlistSql = new SQLFactory(this, "优质商户");
         Rows rows = agentlistSql.runSqlQuery();
-        RowsMap map = getAttachmentUrl("tactivity_agentmsg", rows.toArrayList("tactivity_agentmsgid"));
+        RowsMap map = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"));
         for (Row row : rows) {
-            row.put("attinfos", map.get(row.getString("tactivity_agentmsgid")));
+            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, "优质商户详情");
+        sql.addParameter("tagentsid", content.getString("tagentsid"));
+        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() {
-        SQLFactory agentlistSql = new SQLFactory(this, "热门展品");
+        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) {