浏览代码

Merge remote-tracking branch 'origin/develop' into develop

沈静伟 3 年之前
父节点
当前提交
1137024499

+ 6 - 6
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/供需详情查询_对话框列表.sql

@@ -1,11 +1,11 @@
-select t1.timdialogid, t1.createdate, t4.fagentname, t2.fname, t2.funreadmsgcount, fdatastatus,t3.tagentsid
+select t1.timdialogid, t1.createdate,  t2.fname, t2.funreadmsgcount, fdatastatus
 from timdialog t1
          inner join timdialogusers t2 on t1.siteid = t2.siteid and t1.timdialogid = t2.timdialogid
-         inner join tenterprise_users t3 on t2.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
-         inner join tagents t4 on t3.siteid = t4.siteid and t3.tagentsid = t4.tagentsid
+        -- inner join tenterprise_users t3 on t2.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
+        -- inner join tagents t4 on t3.siteid = t4.siteid and t3.tagentsid = t4.tagentsid
 where t1.siteid = $siteid$
   and t1.ownertable = 'tsupplyanddemand'
-  and t1.ownerid = $tsupplyanddemandid$
+  and t1.ownerid in $tsupplyanddemandid$
   and t1.fdatastatus = '2'
-  and t4.tagentsid != $tagentsid$
-order by (select MAX (timdialogmessageid) timdialogmessageid from timdialogmessage where siteid=$siteid$ and timdialogid=t1.timdialogid group by timdialogid) desc
+  and t1.tenterprise_userid = $userid$
+--order by (select MAX (timdialogmessageid) timdialogmessageid from timdialogmessage where siteid=$siteid$ and timdialogid=t1.timdialogid group by timdialogid) desc

+ 1 - 1
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/即时通讯群最新消息查询.sql

@@ -1,7 +1,7 @@
 select t1.timdialogid,t1.fmessagetype as message,t1.fmessageobj,t3.fname,t1.createdate,t1.ownertable,t1.ownerid from timdialogmessage t1
 inner join (
 select siteid,timdialogid,MAX(timdialogmessageid)timdialogmessageid from timdialogmessage
-where siteid=$siteid$ and timdialogid in $timdialogid$
+where siteid=$siteid$ and timdialogid in $timdialogid$ and tenterprise_userid != $userid$
 group by siteid,timdialogid
 )t2 on t1.siteid=t2.siteid and t1.timdialogid=t2.timdialogid and t1.timdialogmessageid=t2.timdialogmessageid
 left join timdialogusers t3 on t1.siteid=t3.siteid and t1.timdialogid=t3.timdialogid and t1.tenterprise_userid=t3.tenterprise_userid

+ 24 - 18
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/supplyanddemand.java

@@ -61,27 +61,32 @@ public class supplyanddemand extends Controller {
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", rows.toArrayList("tsupplyanddemandid"));
 
-        for (Row row : rows) {
 
-            SQLFactory dialoglistSQL = new SQLFactory(this, "供需详情查询_对话框列表");
-            dialoglistSQL.addParameter("siteid", siteid);
-            dialoglistSQL.addParameter("tagentsid", row.getString("tagentsid"));
-            dialoglistSQL.addParameter("tsupplyanddemandid", row.getString("tsupplyanddemandid"));
-            Rows dialogrows = dbConnect.runSqlQuery(dialoglistSQL.getSQL());
-
-            SQLFactory timnewmsgSQL = new SQLFactory(this, "即时通讯群最新消息查询");
-            timnewmsgSQL.addParameter("siteid", siteid);
-            timnewmsgSQL.addParameter_in("timdialogid", rows.toArrayList("timdialogid"));
-            RowsMap newmsgmap = timnewmsgSQL.runSqlQuery().toRowsMap("timdialogid");
-            for (Row drow : dialogrows) {
-                Rows newmsgrows = newmsgmap.get(drow.getString("timdialogid"));
-                for (Row newmsg : newmsgrows) {
-                    newmsg.put("message", JSONObject.parseObject(newmsg.getString("message")));
-                }
-                drow.put("latestnews", newmsgrows);//最新消息
+
+        SQLFactory dialoglistSQL = new SQLFactory(this, "供需详情查询_对话框列表");
+        dialoglistSQL.addParameter("siteid", siteid);
+        dialoglistSQL.addParameter("userid",userid);
+        dialoglistSQL.addParameter_in("tsupplyanddemandid", rows.toArrayList("tsupplyanddemandid"));
+        System.err.println(dialoglistSQL.getSQL());
+        Rows dialogrows = dbConnect.runSqlQuery(dialoglistSQL.getSQL());
+
+        SQLFactory timnewmsgSQL = new SQLFactory(this, "即时通讯群最新消息查询");
+        timnewmsgSQL.addParameter("siteid", siteid);
+        timnewmsgSQL.addParameter("userid",userid);
+        timnewmsgSQL.addParameter_in("timdialogid", rows.toArrayList("timdialogid"));
+        RowsMap newmsgmap = timnewmsgSQL.runSqlQuery().toRowsMap("timdialogid");
+        for (Row drow : dialogrows) {
+            Rows newmsgrows = newmsgmap.get(drow.getString("timdialogid"));
+            for (Row newmsg : newmsgrows) {
+                newmsg.put("message", JSONObject.parseObject(newmsg.getString("message")));
             }
+            drow.put("latestnews", newmsgrows);//最新消息
+        }
+      RowsMap map=  dialogrows.toRowsMap("tsupplyanddemandid");
 
-            row.put("imdialogs", dialogrows);
+        for (Row row : rows) {
+
+            row.put("imdialogs", map.get(row.getString("tsupplyanddemandid")));
             //附件信息
             row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
             //创建者头像
@@ -232,6 +237,7 @@ public class supplyanddemand extends Controller {
 
         SQLFactory timnewmsgSQL = new SQLFactory(this, "即时通讯群最新消息查询");
         timnewmsgSQL.addParameter("siteid", siteid);
+        timnewmsgSQL.addParameter("userid",userid);
         timnewmsgSQL.addParameter_in("timdialogid", rows.toArrayList("timdialogid"));
         RowsMap newmsgmap = timnewmsgSQL.runSqlQuery().toRowsMap("timdialogid");
         for (Row row : dialogrows) {

+ 25 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/搜索_供需.sql

@@ -0,0 +1,25 @@
+SELECT t1.tsupplyanddemandid,
+       t1.fissupply,
+       t1.ftype,
+       t1.ftitle,
+       t1.fcontent,
+       t1.fstatus,
+       t1.createby,
+       t1.checkby,
+       t1.checkdate,
+       t1.fenddate,
+       t2.fagentname,
+       t1.tagentsid,
+       t1.tenterprise_userid,
+       t1.freadtimes,
+       (select count(0)
+        from timdialog
+        where siteid = t1.siteid
+          and ownertable = 'tsupplyanddemand'
+          and ownerid = t1.tsupplyanddemandid) as fcommunicationtimes
+
+from tsupplyanddemand as t1
+         inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+WHERE t1.siteid = $siteid$
+  and t1.fstatus not in ('н¨')
+  and (t1.fcontent LIKE $keyStr$ OR t1.createby LIKE $keyStr$ OR t1.ftitle LIKE $keyStr$)

+ 27 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/搜索_直播.sql

@@ -0,0 +1,27 @@
+select t1.tliveid,
+       t1.siteid,
+       t1.createby,
+       t1.changeby,
+       t1.createdate,
+       t1.changedate,
+       t1.tactivityid,
+       t1.tliveapplyid,
+       t1.tagentsid,
+       t1.fliveurl_web,
+       t1.fliveurl_client,
+       t1.fliveshowurl,
+       t1.categoryid,
+       t1.categoryname,
+       t1.channelname,
+       t1.channelpasswd,
+       t1.channelid,
+       t1.fassistanturl,
+       t1.fisneedauth,
+       t1.secretkey,
+       t1.livestatus,
+       t1.channelcoverimageurl,
+       t2.fagentname
+from tlive t1
+         inner join tagents t2 on t1.siteid = t2.siteid and t1.tagentsid = t2.tagentsid
+WHERE t1.siteid = $siteid$
+  and (t1.createby LIKE $keyStr$ OR t1.channelname LIKE $keyStr$)

+ 25 - 0
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/SQL/搜索_通告.sql

@@ -0,0 +1,25 @@
+SELECT t1.tnoticeid,
+       t1.ftype,
+       t1.ftitle,
+       t1.fsummary,
+       t1.checkdate,
+       t1.fcontent,
+       t1.createby,
+       t1.createdate,
+       t1.fstatus,
+       t1.changeby,
+       t1.changedate,
+       t1.fisontop,
+       t1.fbegdate,
+       t1.fenddate,
+       t1.freadcount,
+       t1.checkby,
+       t1.fisagentsubuser,
+       t1.fischeckagent,
+       t1.fishomepage,
+       t1.fissingleagent,
+       t1.fisspecifiedrange,
+       t1.tenterprise_userid
+from TNOTICE as t1
+WHERE t1.siteid = $siteid$
+  and (t1.fcontent LIKE $keyStr$ OR t1.createby LIKE $keyStr$ OR t1.ftitle LIKE $keyStr$ OR t1.fsummary LIKE $keyStr$ )

+ 78 - 11
src/dsb/com/cnd3b/restcontroller/publicmethod/homepage/homepage.java

@@ -179,7 +179,7 @@ public class homepage extends Controller {
      * 获取管理端发布的最新通告
      */
     public String getNewestNoticeList() {
-        SQLFactory sql = new SQLFactory(this, "最新管理端发布的通告",pageSize,pageNumber,"t1.createdate DESC");
+        SQLFactory sql = new SQLFactory(this, "最新管理端发布的通告", pageSize, pageNumber, "t1.createdate DESC");
         Rows rows = sql.runSqlQuery();
         for (Row row : rows) {
             row.put("attinfos", getAttachmentUrl("tnotice", row.getString("tnoticeid")));
@@ -208,6 +208,7 @@ public class homepage extends Controller {
 
     /**
      * 新增招商管理表单
+     *
      * @return
      * @throws P2Exception
      */
@@ -223,14 +224,14 @@ public class homepage extends Controller {
 
         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);
+        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();
 
@@ -245,7 +246,7 @@ public class homepage extends Controller {
      *
      * @return
      */
-    public String  getHotAgentsList() {
+    public String getHotAgentsList() {
         SQLFactory agentlistSql = null;
         if (content.containsKey("ftype") && !"".equals(content.getString("ftype"))) {
             String ftype = content.getString("ftype");
@@ -279,7 +280,7 @@ public class homepage extends Controller {
         }
         SQLFactory prodlistSql = new SQLFactory(this, "新品列表", pageSize, pageNumber, "t1.ftype,t1.frownum");
 
-        if(prodlistSql == null){
+        if (prodlistSql == null) {
             return getErrReturnObject().setErrMsg("prodlistSql is null").toString();
         }
         prodlistSql.addParameter("siteid", siteid);
@@ -292,4 +293,70 @@ public class homepage extends Controller {
 
     }
 
+    /**
+     * 门户搜索
+     *
+     * @return
+     */
+    public String searchPortalInfo() {
+        JSONObject resultObject = new JSONObject();
+        String keyStr = content.getString("keyStr");
+        if (keyStr == null || keyStr.equals("")) {
+            return getErrReturnObject().setErrMsg("搜索关键词不能为空").toString();
+        }
+        String ftype = content.getString("ftype");
+        if (ftype == null) {
+            ftype = "";
+        }
+        //查询直播
+        if (ftype.equals("1") || ftype.equals("")) {
+            SQLFactory sqlFactory_tlive = new SQLFactory(this, "搜索_直播");
+            sqlFactory_tlive.addParameter("siteid", siteid);
+            sqlFactory_tlive.addParameter("keyStr", "%" + keyStr + "%");
+            Rows row_tlive = dbConnect.runSqlQuery(sqlFactory_tlive.getSQL());
+            resultObject.put("tlive", row_tlive);
+        } else {
+            resultObject.put("tlive", new Rows());
+        }
+        //查询供需
+        if (ftype.equals("2") || ftype.equals("")) {
+            SQLFactory sqlFactory_tsupplyanddemand = new SQLFactory(this, "搜索_供需");
+            sqlFactory_tsupplyanddemand.addParameter("siteid", siteid);
+            sqlFactory_tsupplyanddemand.addParameter("keyStr", "%" + keyStr + "%");
+            Rows row_tsupplyanddemand = dbConnect.runSqlQuery(sqlFactory_tsupplyanddemand.getSQL());
+            //附件
+            RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", row_tsupplyanddemand.toArrayList("tsupplyanddemandid"));
+            for (Row row : row_tsupplyanddemand) {
+                //附件信息
+                row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
+                row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
+            }
+            resultObject.put("tsupplyanddemand", row_tsupplyanddemand);
+        } else {
+            resultObject.put("tsupplyanddemand", new Rows());
+        }
+
+        //查询通告
+        if (ftype.equals("3") || ftype.equals("")) {
+            SQLFactory sqlFactory_tnotice = new SQLFactory(this, "搜索_通告");
+            sqlFactory_tnotice.addParameter("siteid", siteid);
+            sqlFactory_tnotice.addParameter("keyStr", "%" + keyStr + "%");
+            Rows row_notice = dbConnect.runSqlQuery(sqlFactory_tnotice.getSQL());
+
+            //附件信息
+            RowsMap attinfoRowsMap = getAttachmentUrl("tnotice", row_notice.toArrayList("tnoticeid"));
+            for (Row row : row_notice) {
+                row.put("attinfos", attinfoRowsMap.get(row.getString("tnoticeid")));
+                row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
+            }
+
+            resultObject.put("TNOTICE", row_notice);
+        } else {
+            resultObject.put("TNOTICE", new Rows());
+        }
+
+
+        return getSucReturnObject().setData(resultObject).toString();
+    }
+
 }