Jelajahi Sumber

门户接口开发
1:供需列表查询
2:供需详情查询
3:统计数据展示

沈静伟 4 tahun lalu
induk
melakukan
7b213f3db5

+ 9 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/供需列表查询.sql

@@ -0,0 +1,9 @@
+select t1.tsupplyanddemandid, t1.ftitle,t1.fissupply,
+       t1.ftype, t1.fstatus, t1.checkby, t1.checkdate,
+       t1.fenddate,t1.tcooperationagentsid,t2.fagentname,t3.fname,t3.fphonenumber,t1.tagentsid,
+       t4.fagentname as fcooperationagentname,10 as fcommunicationtimes
+from tsupplyanddemand t1
+inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+inner join tenterprise_users t3 on t1.siteid=t3.siteid and t1.tenterprise_userid=t3.tenterprise_userid
+left join tagents t4 on t1.siteid=t4.siteid and t1.tcooperationagentsid=t4.tagentsid
+where t1.siteid=$siteid$ and $where$

+ 9 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/供需详情查询.sql

@@ -0,0 +1,9 @@
+select t1.tsupplyanddemandid, t1.ftitle,t1.fissupply,
+       t1.ftype, t1.fstatus, t1.checkby, t1.checkdate,
+       t1.fenddate,t1.tcooperationagentsid,t2.fagentname,t3.fname,t3.fphonenumber,
+       t4.fagentname as fcooperationagentname,10 as fcommunicationtimes,t1.fcontent
+from tsupplyanddemand t1
+inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+inner join tenterprise_users t3 on t1.siteid=t3.siteid and t1.tenterprise_userid=t3.tenterprise_userid
+left join tagents t4 on t1.siteid=t4.siteid and t1.tcooperationagentsid=t4.tagentsid
+where t1.siteid=$siteid$ and t1.tagentsid=$tagentsid$ and tsupplyanddemandid=$tsupplyanddemandid$

+ 11 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/统计数据展示.sql

@@ -0,0 +1,11 @@
+select
+sum(t.fagentcount)as fagentcount,
+sum(t.forderamount)as forderamount,
+sum(t.fsupplyanddemandcount)as fsupplyanddemandcount,
+sum(t.fusercount)as fusercount from (
+select count(0)as fagentcount,0 as fsupplyanddemandcount,0 as fusercount,0 as forderamount from tagents where ftype='ÆÕͨ'
+union all
+select 0 as fagentcount,count(0) as fsupplyanddemandcount,0 as fusercount,0 as forderamount from tsupplyanddemand 
+union all
+select 0 as fagentcount,0 as fsupplyanddemandcount,count(0) as fusercount,0 as forderamount from tenterprise_users
+)t

+ 98 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/homepage.java

@@ -0,0 +1,98 @@
+package com.cnd3b.restcontroller.publicmethod.homepage;
+
+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() {
+        SQLFactory sqlFactory = new SQLFactory(this, "统计数据展示");
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
+    }
+
+
+    /**
+     * 供需分类选择查询
+     *
+     * @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");
+        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() {
+        /**
+         *排序条件设置
+         */
+        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", "BWJ");
+        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() {
+        long tsupplyanddemandid = content.getLong("tsupplyanddemandid");
+        long tagentsid = content.getLong("tagentsid");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "供需详情查询");
+        sqlFactory.addParameter("siteid", "BWJ");
+        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();
+    }
+
+
+}