|
|
@@ -214,6 +214,10 @@ public class imdialog extends Controller {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid"); //话题ID 新增时默认传0
|
|
|
long timdialogid = content.getLongValue("timdialogid");
|
|
|
|
|
|
+ if (timsubjectid == 0 && !dbConnect.runSqlQuery("select * from timsubject where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and fisclose=0 ").isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("当前对话框存在为关闭的话题,不可创建新的话题").toString();
|
|
|
+ }
|
|
|
+
|
|
|
boolean ischange = timsubjectid > 0;
|
|
|
|
|
|
PaoSetRemote timsubjectSet = getP2ServerSystemPaoSet("timsubject", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and timsubjectid='" + timsubjectid + "'");
|
|
|
@@ -225,6 +229,7 @@ public class imdialog extends Controller {
|
|
|
timsubject.setValue("createdate", sysdate, 11L);//创建时间
|
|
|
timsubject.setValue("tagentsid", tagentsid, 11L);
|
|
|
timsubject.setValue("tenterprise_userid", userid, 11L);
|
|
|
+ timsubject.setValue("timdialogid", timdialogid, 11L);
|
|
|
|
|
|
timsubjectid = timsubject.getUniqueIDValue();
|
|
|
} else {
|
|
|
@@ -232,7 +237,7 @@ public class imdialog extends Controller {
|
|
|
}
|
|
|
PaoSetRemote timsubjectcontentSet = timsubject.getPaoSet("$timsubjectcontent", "timsubjectcontent");
|
|
|
|
|
|
- if(content.containsKey("fcontent")&&!"".equals(content.getString("fcontent"))){
|
|
|
+ if (content.containsKey("fcontent") && !"".equals(content.getString("fcontent"))) {
|
|
|
String fcontent = content.getString("timsubject", "timsubject.fcontent", "话题内容");//话题内容
|
|
|
PaoRemote timsubjectcontent = timsubjectcontentSet.addAtEnd();
|
|
|
timsubjectcontent.setValue("siteid", siteid, 11L);
|
|
|
@@ -259,6 +264,7 @@ public class imdialog extends Controller {
|
|
|
|
|
|
/**
|
|
|
* 话题关闭
|
|
|
+ *
|
|
|
* @return
|
|
|
* @throws D3bException
|
|
|
* @throws P2Exception
|
|
|
@@ -295,7 +301,7 @@ public class imdialog extends Controller {
|
|
|
row.put("attinfos", map.get(row.getString("timsubjectcontenid")));
|
|
|
}
|
|
|
imsubject.put("imsubjectcontent", imsubjectcontentrows);
|
|
|
- if(!imsubject.getBoolean("fisclose")){
|
|
|
+ if (!imsubject.getBoolean("fisclose")) {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "话题数据分析插入");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("timsubjectid", timsubjectid);
|
|
|
@@ -307,6 +313,24 @@ public class imdialog extends Controller {
|
|
|
return getSucReturnObject().setData(imsubjectrows).toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据对话框ID查询最新未关闭的话题内容
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String queryDialogUncloseSubject() {
|
|
|
+ long timdialogid = content.getLongValue("timdialogid");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select timsubjectid from timsubject where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and fisclose=0 order by timsubjectid desc");
|
|
|
+ if(!rows.isEmpty()){
|
|
|
+ long timsubjectid = rows.get(0).getLong("timsubjectid");
|
|
|
+ content.put("timsubjectid",timsubjectid);
|
|
|
+ return querySubject();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 话题回复
|
|
|
*
|
|
|
@@ -314,11 +338,11 @@ public class imdialog extends Controller {
|
|
|
*/
|
|
|
public String subjectAnswer() {
|
|
|
long timsubjectid = content.getLongValue("timsubjectid");
|
|
|
- Rows rows= dbConnect.runSqlQuery("select fisclose from timsubject where siteid='"+siteid+"' and timsubjectid="+timsubjectid);
|
|
|
- if(!rows.isEmpty()&&!rows.get(0).getBoolean("fisclose")){
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select fisclose from timsubject where siteid='" + siteid + "' and timsubjectid=" + timsubjectid);
|
|
|
+ if (!rows.isEmpty() && !rows.get(0).getBoolean("fisclose")) {
|
|
|
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();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return getErrReturnObject().setErrMsg("话题已关闭或不存在").toString();
|
|
|
}
|
|
|
}
|