| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- 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;
- import p2.pao.PaoRemote;
- import p2.pao.PaoSetRemote;
- import p2.util.P2Exception;
- public class homepage extends Controller {
- public homepage(JSONObject content) {
- super(content);
- }
- /**
- * 统计数据展示
- *
- * @return
- */
- public String getStatisticalData() {
- SQLFactory sqlFactory = new SQLFactory(this, "统计数据展示");
- sqlFactory.addParameter("siteid", siteid);
- 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 ='" + 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() {
- /**
- *排序条件设置
- */
- 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")));
- row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
- }
- 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", 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")));
- row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
- }
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 热门商户
- *
- * @return
- */
- public String agentList() {
- SQLFactory agentlistSql = null;
- if (content.containsKey("saleprodclass") && !"".equals(content.getString("saleprodclass"))) {
- String saleprodclass = content.getString("saleprodclass");
- agentlistSql = new SQLFactory(this, "优质商户", pageSize, pageNumber, "t1.tagentsid");
- agentlistSql.addParameter("saleprodclass", saleprodclass);
- agentlistSql.addParameter("siteid", siteid);
- } else {
- agentlistSql = new SQLFactory(this, "优质商户_全部", pageSize, pageNumber, "t1.tagentsid");
- agentlistSql.addParameter("siteid", siteid);
- }
- Rows rows = agentlistSql.runSqlQuery();
- 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();
- }
- /**
- * 热门商户详情查询
- *
- * @return
- */
- public String agentsMain() {
- SQLFactory sql = new SQLFactory(this, "优质商户详情");
- sql.addParameter("tagentsid", content.getString("tagentsid"));
- sql.addParameter("saleprodclass", content.getString("saleprodclass"));
- sql.addParameter("siteid", siteid);
- 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() {
- long tagentsid = content.getLongValue("tagentsid");
- SQLFactory prodlistSql = new SQLFactory(this, "优质商品", pageSize, pageNumber, "t1.tagents_productid");
- prodlistSql.addParameter("siteid", siteid);
- prodlistSql.addParameter("tagentsid", tagentsid);
- //prodlistSql.addParameter("saleprodclass", content.getString("saleprodclass"));
- Rows rows = prodlistSql.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().setDataByPaging(rows).saveToDataPool(10).toString();
- }
- /**
- * 展会活动信息
- *
- * @return
- */
- public String activityMsg() {
- SQLFactory sql = new SQLFactory(this, "活动信息展示");
- Rows rows = sql.runSqlQuery();
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 获取管理端发布的最新通告
- */
- public String getNewestNoticeList() {
- SQLFactory sql = new SQLFactory(this, "最新管理端发布的通告",pageSize,pageNumber,"t1.createdate DESC");
- Rows rows = sql.runSqlQuery();
- return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
- }
- /**
- * 通告主界面查询
- *
- * @return
- */
- public String query_noticeMain() {
- String tnoticeid = content.getString("tnoticeid");
- SQLFactory noticehead = new SQLFactory(this, "通告主界面查询");
- noticehead.addParameter("siteid", siteid);
- noticehead.addParameter("tnoticeid", tnoticeid);
- Rows rows = dbConnect.runSqlQuery(noticehead.getSQL());
- Rows attinfosRows = getAttachmentUrl("tnotice", tnoticeid);
- rows.get(0).put("attinfos", attinfosRows);
- rows.get(0).put("headportraiturl", getHeadPic(rows.get(0).getLong("tenterprise_userid")));
- return getSucReturnObject().setData(rows).toString();
- }
- /**
- * 新增招商管理表单
- * @return
- * @throws P2Exception
- */
- public String insertBusiness() throws P2Exception {
- String province = content.getString("province");
- String city = content.getString("city");
- String county = content.getString("county");
- String address = content.getString("address");
- String fname = content.getString("fname");
- String fphone = content.getString("fphone");
- String fnote = content.getString("fnote");
- PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("tbusiness");
- PaoRemote paoRemote = paoSetRemote.addAtEnd();
- paoRemote.setValue("province",province,11L);
- paoRemote.setValue("city",city,11L);
- paoRemote.setValue("county",county,11L);
- paoRemote.setValue("address",address,11L);
- paoRemote.setValue("fname",fname,11L);
- paoRemote.setValue("fphone",fphone,11L);
- paoRemote.setValue("fnote",fnote,11L);
- paoRemote.setValue("tbusinessid",paoRemote.getUniqueIDValue(),11L);
- paoSetRemote.save();
- return getSucReturnObject().toString();
- }
- /**
- * 获取热门商户列表(关注)
- *
- * @return
- */
- public String getHotAgentsList() {
- SQLFactory agentlistSql = null;
- if (content.containsKey("ftype") && !"".equals(content.getString("ftype"))) {
- String ftype = content.getString("ftype");
- agentlistSql = new SQLFactory(this, "热门商户列表", pageSize, pageNumber, "t1.frownum");
- agentlistSql.addParameter("ftype", ftype);
- agentlistSql.addParameter("siteid", siteid);
- } else {
- agentlistSql = new SQLFactory(this, "热门商户列表_全部", pageSize, pageNumber, "t1.ftype,t1.frownum");
- agentlistSql.addParameter("siteid", siteid);
- }
- System.err.println(agentlistSql.getSQL());
- Rows rows = dbConnect.runSqlQuery(agentlistSql.getSQL());
- RowsMap map = getAttachmentUrl("texcellentagents", rows.toArrayList("texcellentagentsid"));
- for (Row row : rows) {
- row.put("attinfos", map.get(row.getString("texcellentagentsid")));
- }
- return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
- }
- }
|