فهرست منبع

热门商户:添加热门商户,删除热门商户,获取热门商户列表

吴志根 3 سال پیش
والد
کامیت
7a2ca9b7cb

+ 7 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/热门商户列表.sql

@@ -0,0 +1,7 @@
+SELECT t2.tagentsid, t2.saleprodclass, t2.fbrand, t2.fagentname, t1.frownum, t1.texcellentagentsid
+FROM texcellentagents as t1
+         LEFT JOIN tagents as t2
+                   ON t1.tagentsid = t2.tagentsid
+
+where t2.saleprodclass = $saleprodclass$
+  and t2.siteid = $siteid$

+ 6 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/热门商户列表_全部.sql

@@ -0,0 +1,6 @@
+SELECT t2.tagentsid, t2.saleprodclass, t2.fbrand, t2.fagentname, t1.frownum, t1.texcellentagentsid
+FROM texcellentagents as t1
+         LEFT JOIN tagents as t2
+                   ON t1.tagentsid = t2.tagentsid
+
+where  t2.siteid = $siteid$

+ 76 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -312,4 +312,80 @@ public class tagents extends Controller {
         Rows rows = dbConnect.runSqlQuery(sql.getSQL());
         return getSucReturnObject().setData(rows).saveToDataPool().toString();
     }
+
+
+    /**
+     * 添加热门商户
+     *
+     * @return
+     * @throws P2Exception
+     */
+    public String addHotAgents() throws P2Exception {
+
+        String tagentsid = content.getString("tagentsid");
+        String frownum = content.getString("frownum");
+
+        PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("texcellentagents", "tagentsid = '" + tagentsid + "' OR frownum = '" + frownum + "'", "changedate");
+        if (paoSetRemote.isEmpty()) {
+            PaoRemote paoRemote = paoSetRemote.addAtEnd();
+            paoRemote.setValue("texcellentagentsid", paoRemote.getUniqueIDValue(), 11L);
+            paoRemote.setValue("tagentsid", tagentsid);
+            paoRemote.setValue("frownum", frownum);
+            paoSetRemote.save();
+            return getSucReturnObject().toString();
+        } else {
+            return getErrReturnObject().setErrMsg("商户已存在或者当前排序以设置对应商户").toString();
+        }
+
+    }
+
+    /**
+     * 删除热门商户
+     *
+     * @return
+     */
+    public String deleteHotAgents() {
+        String texcellentagentsid = content.getString("texcellentagentsid");
+
+        String sql = "DELETE FROM texcellentagents WHERE texcellentagentsid = '" + texcellentagentsid + "'";
+
+        String response = dbConnect.runSqlUpdate(sql);
+        if (response.equals("true")) {
+            return getSucReturnObject().toString();
+        } else {
+            return getErrReturnObject().toString();
+        }
+
+    }
+
+
+    /**
+     * 获取热门商户列表
+     *
+     * @return
+     */
+    public String getHotAgentsList() {
+        SQLFactory agentlistSql = null;
+        if (content.containsKey("saleprodclass") && !"".equals(content.getString("saleprodclass"))) {
+            String saleprodclass = content.getString("saleprodclass");
+            agentlistSql = new SQLFactory(this, "热门商户列表", pageSize, pageNumber, "t1.frownum");
+            agentlistSql.addParameter("saleprodclass", saleprodclass);
+            agentlistSql.addParameter("siteid", siteid);
+        } else {
+            agentlistSql = new SQLFactory(this, "热门商户列表_全部", pageSize, pageNumber, "t1.frownum");
+            agentlistSql.addParameter("siteid", siteid);
+        }
+
+        System.err.println(agentlistSql.getSQL());
+        Rows rows = dbConnect.runSqlQuery(agentlistSql.getSQL());
+        RowsMap map = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"));
+        for (Row row : rows) {
+            row.put("attinfos", map.get(row.getString("tagentsid")));
+            row.put("saleprodclass", JSONArray.parseArray(row.getString("saleprodclass")));
+        }
+        return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
+
+
+    }
+
 }