|
|
@@ -8,6 +8,8 @@ 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 com.cnd3b.common.parameter.parameter;
|
|
|
+import com.cnd3b.common.websocket.WebClientSocket;
|
|
|
import p2.pao.PaoRemote;
|
|
|
import p2.pao.PaoSetRemote;
|
|
|
import p2.util.P2Exception;
|
|
|
@@ -205,13 +207,17 @@ public class imdialog extends Controller {
|
|
|
|
|
|
/**
|
|
|
* 创建聊天话题
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
public String createSubject() throws D3bException, P2Exception {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid"); //话题ID 新增时默认传0
|
|
|
+ long timdialogid = content.getLongValue("timdialogid");
|
|
|
String fcontent = content.getString("timsubject", "timsubject.fcontent", "话题内容");//话题内容
|
|
|
|
|
|
- PaoSetRemote timsubjectSet = getP2ServerSystemPaoSet("timsubject", "siteid='" + siteid + "' and tagentsid='"+tagentsid+"' and timsubjectid='" + timsubjectid + "'");
|
|
|
+ boolean ischange = timsubjectid > 0;
|
|
|
+
|
|
|
+ PaoSetRemote timsubjectSet = getP2ServerSystemPaoSet("timsubject", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and timsubjectid='" + timsubjectid + "'");
|
|
|
PaoRemote timsubject = null;
|
|
|
if (timsubjectid <= 0 || timsubjectSet.isEmpty()) {
|
|
|
timsubject = timsubjectSet.addAtEnd();
|
|
|
@@ -222,71 +228,105 @@ public class imdialog extends Controller {
|
|
|
timsubject.setValue("tenterprise_userid", userid, 11L);
|
|
|
|
|
|
timsubjectid = timsubject.getUniqueIDValue();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
timsubject = timsubjectSet.getPao(0);
|
|
|
}
|
|
|
- timsubject.setValue("fcontent", fcontent, 11L);
|
|
|
+ PaoSetRemote timsubjectcontentSet = timsubject.getPaoSet("$timsubjectcontent", "timsubjectcontent");
|
|
|
+
|
|
|
+ PaoRemote timsubjectcontent = timsubjectcontentSet.addAtEnd();
|
|
|
+ timsubjectcontent.setValue("siteid", siteid, 11L);
|
|
|
+ timsubjectcontent.setValue("createdate", sysdate, 11L);
|
|
|
+ timsubjectcontent.setValue("timsubjectid", timsubjectid, 11L);
|
|
|
+ timsubjectcontent.setValue("fcontent", fcontent, 11L);
|
|
|
+
|
|
|
timsubjectSet.save();
|
|
|
content.put("timsubjectid", timsubjectid);
|
|
|
- return query_imdialogMain();
|
|
|
+ if (ischange) {//话题内容变更,通知前端进行数据刷新
|
|
|
+ for (long userid : getImDialogUserIds(timdialogid)) {
|
|
|
+ if (parameter.websocketClients.containsKey(userid)) {
|
|
|
+ JSONObject methodobject = new JSONObject();
|
|
|
+ methodobject.put("type", "callmethod");
|
|
|
+ methodobject.put("classname", "system.im.imdialog.imdialog");
|
|
|
+ methodobject.put("method", "querySubject");
|
|
|
+ methodobject.put("dataid", timsubjectid);
|
|
|
+ for (WebClientSocket webClientSocket : parameter.websocketClients.get(userid).values()) {
|
|
|
+ webClientSocket.sendSystemMessage(methodobject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return querySubject();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 话题内容查询
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public String querySubject(){
|
|
|
+ public String querySubject() {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid");
|
|
|
- SQLFactory timsubjectSQL = new SQLFactory(this, "话题详情查询");
|
|
|
+ SQLFactory timsubjectSQL = new SQLFactory(this, "话题查询");
|
|
|
timsubjectSQL.addParameter("siteid", siteid);
|
|
|
timsubjectSQL.addParameter("timsubjectid", timsubjectid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(timsubjectSQL.getSQL());
|
|
|
- rows.get(0).put("attinfos",getAttachmentUrl("timsubject",String.valueOf(timsubjectid)));
|
|
|
-
|
|
|
- SQLFactory sqlFactory=new SQLFactory(this,"话题数据分析插入");
|
|
|
- sqlFactory.addParameter("siteid",siteid);
|
|
|
- sqlFactory.addParameter("timsubjectid",timsubjectid);
|
|
|
- sqlFactory.addParameter("tenterprise_userid",userid);
|
|
|
- sqlFactory.addParameter("tagentsid",tagentsid);
|
|
|
+ Rows imsubjectrows = dbConnect.runSqlQuery(timsubjectSQL.getSQL());
|
|
|
+
|
|
|
+ for (Row imsubject : imsubjectrows) {
|
|
|
+ SQLFactory timsubjectcontentSQL = new SQLFactory(this, "话题内容查询");
|
|
|
+ timsubjectcontentSQL.addParameter("siteid", siteid);
|
|
|
+ timsubjectcontentSQL.addParameter("timsubjectid", imsubject.getLong("timsubjectid"));
|
|
|
+ Rows imsubjectcontentrows = dbConnect.runSqlQuery(timsubjectcontentSQL.getSQL());
|
|
|
+ RowsMap map = getAttachmentUrl("timsubjectconte", imsubjectcontentrows.toArrayList("timsubjectcontenid"));
|
|
|
+ for (Row row : imsubjectcontentrows) {
|
|
|
+ row.put("attinfos", map.get(row.getString("timsubjectcontenid")));
|
|
|
+ }
|
|
|
+ imsubject.put("imsubjectcontent", imsubjectcontentrows);
|
|
|
+ }
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "话题数据分析插入");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("timsubjectid", timsubjectid);
|
|
|
+ sqlFactory.addParameter("tenterprise_userid", userid);
|
|
|
+ sqlFactory.addParameter("tagentsid", tagentsid);
|
|
|
dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
- return getSucReturnObject().setData(rows).toString();
|
|
|
+ return getSucReturnObject().setData(imsubjectrows).toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 话题回复
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public String subjectAnswer(){
|
|
|
+ public String subjectAnswer() {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid");
|
|
|
- dbConnect.runSqlUpdate("update timsubjectanalysis set fisanswer=1,fanswertime=getDate() where siteid='"+siteid+"' and timsubjectid='"+timsubjectid+"' and tenterprise_userid='"+userid+"' and fisanswer=0");
|
|
|
+ dbConnect.runSqlUpdate("update timsubjectanalysis set fisanswer=1,fanswertime=getDate() where siteid='" + siteid + "' and timsubjectid='" + timsubjectid + "' and tenterprise_userid='" + userid + "' and fisanswer=0");
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 话题统计信息查询
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public String querySubjectAnalysis(){
|
|
|
+ public String querySubjectAnalysis() {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid");//话题ID
|
|
|
long timdialogid = content.getLongValue("timdialogid");//对话框ID
|
|
|
|
|
|
- SQLFactory sqlFactory=new SQLFactory(this,"话题数据分析查询");
|
|
|
- sqlFactory.addParameter("siteid",siteid);
|
|
|
- sqlFactory.addParameter("timsubjectid",timsubjectid);
|
|
|
- sqlFactory.addParameter("timdialogid",timdialogid);
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "话题数据分析查询");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("timsubjectid", timsubjectid);
|
|
|
+ sqlFactory.addParameter("timdialogid", timdialogid);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
- for(Row row:rows){
|
|
|
- row.put("headportraiturl",getHeadPic(row.getLong("tenterprise_userid")));
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
|
|
|
}
|
|
|
- RowsMap fisreadmap= rows.toRowsMap("fisread");
|
|
|
- RowsMap fisanswermap= rows.toRowsMap("fisanswer");
|
|
|
+ RowsMap fisreadmap = rows.toRowsMap("fisread");
|
|
|
+ RowsMap fisanswermap = rows.toRowsMap("fisanswer");
|
|
|
|
|
|
- JSONObject object=new JSONObject();
|
|
|
- object.put("readlist",fisreadmap.get("1"));
|
|
|
- object.put("unreadlist",fisreadmap.get("0"));
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("readlist", fisreadmap.get("1"));
|
|
|
+ object.put("unreadlist", fisreadmap.get("0"));
|
|
|
|
|
|
- object.put("answerlist",fisanswermap.get("1"));
|
|
|
- object.put("unanswerlist",fisanswermap.get("0"));
|
|
|
+ object.put("answerlist", fisanswermap.get("1"));
|
|
|
+ object.put("unanswerlist", fisanswermap.get("0"));
|
|
|
|
|
|
return getSucReturnObject().setData(object).toString();
|
|
|
}
|