|
|
@@ -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();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|