Преглед на файлове

我的供需详情查询返回对话框创建时间,供需列表查询添加最后一条对话框信息

吴志根 преди 3 години
родител
ревизия
f13b879398

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

@@ -0,0 +1,9 @@
+select t1.timdialogid, t1.createdate, t4.fagentname, 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
+where t1.siteid = $siteid$
+  and t1.ownertable = 'tsupplyanddemand'
+  and t1.ownerid = $tsupplyanddemandid$
+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,4 +1,4 @@
-select t1.timdialogid,t4.fagentname,t2.fname,t2.funreadmsgcount,fdatastatus from timdialog t1
+select t1.timdialogid,t1.createdate,t4.fagentname,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

+ 22 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/supplyanddemand.java

@@ -56,10 +56,32 @@ public class supplyanddemand extends Controller {
         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) {
+
+            SQLFactory dialoglistSQL = new SQLFactory(this, "供需详情查询_对话框列表");
+            dialoglistSQL.addParameter("siteid", siteid);
+            dialoglistSQL.addParameter("tagentsid", 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);//最新消息
+            }
+
+            row.put("imdialogs", dialogrows);
             //附件信息
             row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
             //创建者头像