|
|
@@ -202,4 +202,92 @@ public class imdialog extends Controller {
|
|
|
content.put("timdialogid", timdialogid);
|
|
|
return query_imdialogMain();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建聊天话题
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String createSubject() throws D3bException, P2Exception {
|
|
|
+ long timsubjectid = content.getLongValue("timsubjectid"); //话题ID 新增时默认传0
|
|
|
+ String fcontent = content.getString("timsubject", "timsubject.fcontent", "话题内容");//话题内容
|
|
|
+
|
|
|
+ PaoSetRemote timsubjectSet = getP2ServerSystemPaoSet("timsubject", "siteid='" + siteid + "' and tagentsid='"+tagentsid+"' and timsubjectid='" + timsubjectid + "'");
|
|
|
+ PaoRemote timsubject = null;
|
|
|
+ if (timsubjectid <= 0 || timsubjectSet.isEmpty()) {
|
|
|
+ timsubject = timsubjectSet.addAtEnd();
|
|
|
+ timsubject.setValue("siteid", siteid, 11L);//企业ID
|
|
|
+ timsubject.setValue("createby", username, 11L);//创建人
|
|
|
+ timsubject.setValue("createdate", sysdate, 11L);//创建时间
|
|
|
+ timsubject.setValue("tagentsid", tagentsid, 11L);
|
|
|
+ timsubject.setValue("tenterprise_userid", userid, 11L);
|
|
|
+
|
|
|
+ timsubjectid = timsubject.getUniqueIDValue();
|
|
|
+ }else{
|
|
|
+ timsubject = timsubjectSet.getPao(0);
|
|
|
+ }
|
|
|
+ timsubject.setValue("fcontent", fcontent, 11L);
|
|
|
+ timsubjectSet.save();
|
|
|
+ content.put("timsubjectid", timsubjectid);
|
|
|
+ return query_imdialogMain();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 话题内容查询
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String querySubject(){
|
|
|
+ long timsubjectid = content.getLongValue("timsubjectid");
|
|
|
+ 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);
|
|
|
+ dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 话题回复
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ 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");
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 话题统计信息查询
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ 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);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ for(Row row:rows){
|
|
|
+ row.put("headportraiturl",getHeadPic(row.getLong("tenterprise_userid")));
|
|
|
+ }
|
|
|
+ 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"));
|
|
|
+
|
|
|
+ object.put("answerlist",fisanswermap.get("1"));
|
|
|
+ object.put("unanswerlist",fisanswermap.get("0"));
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(object).toString();
|
|
|
+ }
|
|
|
}
|