imdialog.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. package com.cnd3b.restcontroller.system.im.imdialog;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.cnd3b.common.Controller;
  5. import com.cnd3b.common.D3bException;
  6. import com.cnd3b.common.data.Row;
  7. import com.cnd3b.common.data.Rows;
  8. import com.cnd3b.common.data.RowsMap;
  9. import com.cnd3b.common.data.SQLFactory;
  10. import com.cnd3b.common.parameter.parameter;
  11. import com.cnd3b.common.websocket.WebClientSocket;
  12. import com.cnd3b.utility.Encryption;
  13. import org.apache.ibatis.jdbc.SQL;
  14. import p2.pao.PaoRemote;
  15. import p2.pao.PaoSetRemote;
  16. import p2.util.P2Exception;
  17. import java.util.ArrayList;
  18. import java.util.Calendar;
  19. public class imdialog extends Controller {
  20. /**
  21. * 构造函数
  22. *
  23. * @param content
  24. */
  25. public imdialog(JSONObject content) {
  26. super(content);
  27. }
  28. /**
  29. * 群对话框列表查询
  30. *
  31. * @return
  32. */
  33. public String query_imdialogList() {
  34. /**
  35. * 过滤条件设置
  36. */
  37. StringBuffer where = new StringBuffer(" 1=1 ");
  38. if (content.containsKey("where")) {
  39. JSONObject whereObject = content.getJSONObject("where");
  40. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  41. where.append(" and(");
  42. where.append("t1.fimdialogname like'%").append(whereObject.getString("condition")).append("%' ");
  43. where.append(")");
  44. }
  45. if (whereObject.containsKey("fimdialogtype") && !"".equals(whereObject.getString("fimdialogtype"))) {
  46. where.append(" and(");
  47. where.append("t1.fimdialogtype ='").append(whereObject.getString("fimdialogtype")).append("' ");
  48. where.append(")");
  49. }
  50. //fimdialogtype2:不等于这个类型的
  51. if (whereObject.containsKey("fimdialogtype2") && !"".equals(whereObject.getString("fimdialogtype2"))) {
  52. where.append(" and(");
  53. where.append("t1.fimdialogtype !='").append(whereObject.getString("fimdialogtype2")).append("' ");
  54. where.append(")");
  55. }
  56. }
  57. SQLFactory timdialogSQL = new SQLFactory(this, "即时通讯普通群列表查询");
  58. timdialogSQL.addParameter("siteid", siteid);
  59. timdialogSQL.addParameter("tenterprise_userid", userid);
  60. timdialogSQL.addParameter_SQL("where", where);
  61. Rows rows = dbConnect.runSqlQuery(timdialogSQL.getSQL());
  62. SQLFactory timdialoguserSQL = new SQLFactory(this, "即时通讯群成员列表查询");
  63. timdialoguserSQL.addParameter("siteid", siteid);
  64. timdialoguserSQL.addParameter_in("timdialogid", rows.toArrayList("timdialogid"));
  65. RowsMap timdialoguserRowsMap = dbConnect.runSqlQuery(timdialoguserSQL.getSQL()).toRowsMap("timdialogid");
  66. SQLFactory timnewmsgSQL = new SQLFactory(this, "即时通讯普通群最新消息查询");
  67. timnewmsgSQL.addParameter("siteid", siteid);
  68. timnewmsgSQL.addParameter_in("timdialogid", rows.toArrayList("timdialogid"));
  69. RowsMap newmsgmap = timnewmsgSQL.runSqlQuery().toRowsMap("timdialogid");
  70. for (Row row : rows) {
  71. Rows newmsgrows = newmsgmap.get(row.getString("timdialogid"));
  72. for (Row newmsg : newmsgrows) {
  73. newmsg.put("message", JSONObject.parseObject(newmsg.getString("message")));
  74. newmsg.put("fisonline", parameter.websocketClients.containsKey(newmsg.getLong("tenterprise_userid")) ? 1 : 0);
  75. }
  76. row.put("latestnews", newmsgrows);//最新消息
  77. Rows timdialoguserRows = timdialoguserRowsMap.get(row.getString("timdialogid"));
  78. for (Row user : timdialoguserRows) {
  79. user.put("headportraiturl", getHeadPic(user.getLong("tenterprise_userid")));
  80. }
  81. row.put("users", timdialoguserRows);//群成员头像
  82. }
  83. return getSucReturnObject().setData(rows).saveToDataPool().toString();
  84. }
  85. /**
  86. * 群主界面查询
  87. *
  88. * @return
  89. */
  90. public String query_imdialogMain() throws D3bException, P2Exception {
  91. long timdialogid = content.getLong("timdialogid");
  92. SQLFactory timdialogSQL = new SQLFactory(this, "即时通讯群主界面查询");
  93. timdialogSQL.addParameter("siteid", siteid);
  94. timdialogSQL.addParameter("tenterprise_userid", userid);
  95. timdialogSQL.addParameter("timdialogid", timdialogid);
  96. Rows rows = dbConnect.runSqlQuery(timdialogSQL.getSQL());
  97. for (Row row : rows) {
  98. SQLFactory timdialoguserSQL = new SQLFactory(this, "即时通讯群成员列表查询");
  99. timdialoguserSQL.addParameter("siteid", siteid);
  100. timdialoguserSQL.addParameter_in("timdialogid", content.getString("timdialogid"));
  101. Rows userrows = dbConnect.runSqlQuery(timdialoguserSQL.getSQL());
  102. int onlinecount = 0;
  103. for (Row user : userrows) {
  104. boolean isonline = parameter.websocketClients.containsKey(user.getLong("tenterprise_userid"));
  105. if (isonline) {
  106. user.put("fisonline", 1);
  107. onlinecount = onlinecount + 1;
  108. } else {
  109. user.put("fisonline", 0);
  110. }
  111. user.put("headportraiturl", getHeadPic(user.getLong("tenterprise_userid")));
  112. }
  113. row.put("users", userrows);
  114. row.put("usertotalcount", userrows.size());
  115. row.put("useronlinecount", onlinecount);
  116. }
  117. if (content.containsKey("message")) {
  118. //初始聊天记录,话题
  119. JSONObject messageObject = content.getJSONObject("message");
  120. long messageuserid = messageObject.getJSONObject("sendfrom").getLong("userid");
  121. messageObject.put("timdialogid", timdialogid);
  122. messageObject.put("fdatetime", getDateTime_Str());
  123. messageObject.put("fmessageid", new Encryption().Encode_MD5(siteid + messageuserid + Calendar.getInstance().getTimeInMillis()));
  124. SQLFactory sqlFactory = new SQLFactory(this, "即时通讯群消息插入");
  125. sqlFactory.addParameter("siteid", siteid);
  126. sqlFactory.addParameter("fnotes", "话题回复");
  127. sqlFactory.addParameter("timdialogid", timdialogid);
  128. sqlFactory.addParameter("tenterprise_userid", messageuserid);
  129. sqlFactory.addParameter("fmessageobj", messageObject.toJSONString());
  130. sqlFactory.addParameter("fmessageid", messageObject.getString("messageid"));
  131. sqlFactory.addParameter("fmessagetype", messageObject.getString("ftype"));
  132. if ("data".equals(messageObject.getString("ftype"))) {
  133. sqlFactory.addParameter("ownerid", messageObject.getJSONObject("data").getString("ownerid"));
  134. sqlFactory.addParameter("ownertable", messageObject.getJSONObject("data").getString("ownertable"));
  135. } else {
  136. sqlFactory.addParameter("ownerid", "null");
  137. sqlFactory.addParameter("ownertable", "null");
  138. }
  139. dbConnect.runSqlUpdate(sqlFactory.getSQL());
  140. }
  141. return getSucReturnObject().setData(rows).toString();
  142. }
  143. /**
  144. * 一键联系
  145. *
  146. * @return
  147. */
  148. public String quickcontact() throws D3bException, P2Exception {
  149. long tenterprise_userid = content.getLongValue("tenterprise_userid");//根据对方userid,查一对一聊天对话框
  150. SQLFactory factory = new SQLFactory(this, "根据用户ID查询一对一聊天对话框ID");
  151. factory.addParameter("siteid", siteid);
  152. factory.addParameter_in("tenterprise_userid", new String[]{String.valueOf(userid), String.valueOf(tenterprise_userid)});
  153. Rows rows = dbConnect.runSqlQuery(factory.getSQL());
  154. if (!rows.isEmpty()) {
  155. content.put("timdialogid", rows.get(0).getLong("timdialogid"));
  156. return query_imdialogMain();
  157. } else {
  158. JSONArray usersArray = new JSONArray();
  159. usersArray.add(String.valueOf(userid));
  160. usersArray.add(String.valueOf(tenterprise_userid));
  161. content.put("fimdialogname", username + "-" + getUser(tenterprise_userid).getString("fname"));
  162. content.put("fimdialogtype", "普通");
  163. content.put("users", usersArray);
  164. return insertOrModify();
  165. }
  166. }
  167. /**
  168. * 群消息查询
  169. *
  170. * @return
  171. */
  172. public String query_imdialogMessage() {
  173. long timdialogid = content.getLong("timdialogid");
  174. /**
  175. *排序条件设置
  176. */
  177. String[] sortfield = {"t1.timdialogmessageid desc"};
  178. String sort = getSort(sortfield, "t1.timdialogmessageid desc");
  179. /**
  180. * 过滤条件设置
  181. */
  182. StringBuffer where = new StringBuffer(" 1=1 ");
  183. if (content.containsKey("where")) {
  184. JSONObject whereObject = content.getJSONObject("where");
  185. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  186. where.append(" and(");
  187. where.append("t1.fnotes like'%").append(whereObject.getString("condition")).append("%' ");
  188. where.append(")");
  189. }
  190. if (whereObject.containsKey("begdate") && !"".equals(whereObject.getString("begdate"))) {
  191. where.append(" and convert(varchar(10),t1.createdate,120)>=").append("'").append(whereObject.getString("begdate")).append("'");
  192. }
  193. if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
  194. where.append(" and convert(varchar(10),t1.createdate,120)<=").append("'").append(whereObject.getString("enddate")).append("'");
  195. }
  196. }
  197. SQLFactory timdialogSQL = new SQLFactory(this, "即时通讯群历史消息查询", pageSize, pageNumber, sort);
  198. timdialogSQL.addParameter("siteid", siteid);
  199. timdialogSQL.addParameter("timdialogid", timdialogid);
  200. timdialogSQL.addParameter_SQL("where", where);
  201. Rows rows = dbConnect.runSqlQuery(timdialogSQL.getSQL());
  202. for (Row row : rows) {
  203. String message = row.getString("message");
  204. row.put("message", JSONObject.parseObject(message));
  205. }
  206. //清除未读消息数
  207. dbConnect.runSqlUpdate("update timdialogusers set funreadmsgcount=0 where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and tenterprise_userid='" + userid + "'");
  208. return getSucReturnObject().setDataByPaging(rows).toString();
  209. }
  210. public String restUnReadMsgCount() {
  211. long timdialogid = content.getLong("timdialogid");
  212. dbConnect.runSqlUpdate("update timdialogusers set funreadmsgcount=0 where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and tenterprise_userid='" + userid + "'");
  213. return getSucReturnObject().toString();
  214. }
  215. /**
  216. * 新建聊天对话框
  217. *
  218. * @return
  219. * @throws D3bException
  220. * @throws P2Exception
  221. */
  222. public String insertOrModify() throws D3bException, P2Exception {
  223. long timdialogid = content.getLongValue("timdialogid"); //群ID 新增时默认传0
  224. String fimdialogname = content.getString("fimdialogname", "timdialog.fimdialogname", "群名称");//群名称
  225. String fimdialogtype = content.getString("fimdialogtype");//对话类型
  226. String ownertable = content.getString("ownertable");//所有表
  227. String ownerid = content.getString("ownerid");//所有表ID
  228. JSONArray usersArray = content.getJSONArray("users");
  229. ArrayList<String> sqlList = new ArrayList<>();
  230. PaoSetRemote timdialogSet = getP2ServerSystemPaoSet("timdialog", "siteid='" + siteid + "' and timdialogid='" + timdialogid + "'");
  231. PaoRemote timdialog = null;
  232. if (timdialogid <= 0 || timdialogSet.isEmpty()) {
  233. /**
  234. * 创建对话框
  235. */
  236. timdialog = timdialogSet.addAtEnd();
  237. timdialog.setValue("siteid", siteid, 11L);//企业ID
  238. timdialog.setValue("createby", username, 11L);//创建人
  239. timdialog.setValue("createdate", sysdate, 11L);//创建时间
  240. timdialog.setValue("fimdialogtype", fimdialogtype, 11L);//对话框类型
  241. timdialog.setValue("ownertable", ownertable, 11L);//所有表
  242. timdialog.setValue("ownerid", ownerid, 11L);//所有表ID
  243. timdialog.setValue("tenterprise_userid", userid, 11L);//创建账号ID
  244. timdialogid = timdialog.getUniqueIDValue();
  245. } else {
  246. timdialog = timdialogSet.getPao(0);
  247. }
  248. timdialog.setValue("fimdialogname", fimdialogname, 11L);//对话框类型
  249. timdialogSet.save();
  250. /**
  251. * 在初始对话框中添加人员
  252. */
  253. ArrayList<String> userlist = new ArrayList<>();
  254. usersArray.add(userid);//默认将创建人员加入群
  255. for (Object user : usersArray) {
  256. userlist.add(String.valueOf(user));
  257. }
  258. SQLFactory sqlFactory = new SQLFactory(this, "即时通讯群人员添加");
  259. sqlFactory.addParameter("createby", username);
  260. sqlFactory.addParameter("timdialogid", timdialogid);
  261. sqlFactory.addParameter("siteid", siteid);
  262. sqlFactory.addParameter_in("tenterprise_userid", userlist);
  263. sqlList.add(sqlFactory.getSQL());
  264. dbConnect.runSqlUpdate(sqlList);
  265. content.put("timdialogid", timdialogid);
  266. return query_imdialogMain();
  267. }
  268. /**
  269. * 更新群成员信息
  270. *
  271. * @return
  272. */
  273. public String updateDialoguser() {
  274. long timdialogid = content.getLongValue("timdialogid");
  275. long tenterprise_userid = content.getLong("tenterprise_userid");
  276. String fimdialognotes = content.getString("fimdialognotes");
  277. int fisremove = content.getIntValue("fisremove");
  278. String status = dbConnect.runSqlUpdate("update timdialogusers set fisremove=" + fisremove + ",fimdialognotes='" + fimdialognotes + "' where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and tenterprise_userid='" + tenterprise_userid + "'");
  279. if ("true".equalsIgnoreCase(status)) {
  280. return getSucReturnObject().toString();
  281. } else {
  282. return getErrReturnObject().toString();
  283. }
  284. }
  285. /**
  286. * 创建聊天话题
  287. *
  288. * @return
  289. */
  290. public String createSubject() throws D3bException, P2Exception {
  291. long timsubjectid = content.getLongValue("timsubjectid"); //话题ID 新增时默认传0
  292. long timdialogid = content.getLongValue("timdialogid");
  293. if (timsubjectid == 0 && !dbConnect.runSqlQuery("select * from timsubject where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and fisclose=0 ").isEmpty()) {
  294. return getErrReturnObject().setErrMsg("当前对话框存在为关闭的话题,不可创建新的话题").toString();
  295. }
  296. boolean ischange = timsubjectid > 0;
  297. PaoSetRemote timsubjectSet = getP2ServerSystemPaoSet("timsubject", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and timsubjectid='" + timsubjectid + "'");
  298. PaoRemote timsubject = null;
  299. if (timsubjectid <= 0 || timsubjectSet.isEmpty()) {
  300. timsubject = timsubjectSet.addAtEnd();
  301. timsubject.setValue("siteid", siteid, 11L);//企业ID
  302. timsubject.setValue("createby", username, 11L);//创建人
  303. timsubject.setValue("createdate", sysdate, 11L);//创建时间
  304. timsubject.setValue("tagentsid", tagentsid, 11L);
  305. timsubject.setValue("tenterprise_userid", userid, 11L);
  306. timsubject.setValue("timdialogid", timdialogid, 11L);
  307. timsubjectid = timsubject.getUniqueIDValue();
  308. } else {
  309. timsubject = timsubjectSet.getPao(0);
  310. }
  311. PaoSetRemote timsubjectcontentSet = timsubject.getPaoSet("$timsubjectcontent", "timsubjectcontent");
  312. if (content.containsKey("fcontent") && !"".equals(content.getString("fcontent"))) {
  313. String fcontent = content.getString("fcontent", "timsubjectcontent.fcontent", "话题内容");//话题内容
  314. PaoRemote timsubjectcontent = timsubjectcontentSet.addAtEnd();
  315. timsubjectcontent.setValue("siteid", siteid, 11L);
  316. timsubjectcontent.setValue("createdate", sysdate, 11L);
  317. timsubjectcontent.setValue("timsubjectid", timsubjectid, 11L);
  318. timsubjectcontent.setValue("fcontent", fcontent, 11L);
  319. }
  320. timsubjectSet.save();
  321. content.put("timsubjectid", timsubjectid);
  322. if (ischange) {//话题内容变更,通知前端进行数据刷新
  323. for (long userid : getImDialogUserIds(timdialogid)) {
  324. if (parameter.websocketClients.containsKey(userid)) {
  325. JSONObject methodobject = new JSONObject();
  326. methodobject.put("type", "refreshimdialog");
  327. methodobject.put("timdialogid", timdialogid);
  328. for (WebClientSocket webClientSocket : parameter.websocketClients.get(userid).values()) {
  329. webClientSocket.sendSystemMessage(methodobject);
  330. }
  331. }
  332. }
  333. }
  334. return querySubject();
  335. }
  336. /**
  337. * 话题关闭
  338. *
  339. * @return
  340. * @throws D3bException
  341. * @throws P2Exception
  342. */
  343. public String closeSubject() throws D3bException, P2Exception {
  344. long timsubjectid = content.getLongValue("timsubjectid"); //话题ID 新增时默认传0
  345. long timdialogid = content.getLongValue("timdialogid");
  346. String status = dbConnect.runSqlUpdate("update timsubject set fisclose=1,closedate=getDate() where siteid='" + siteid + "' and timsubjectid='" + timsubjectid + "'");
  347. if ("true".equals(status)) {
  348. for (long userid : getImDialogUserIds(timdialogid)) {
  349. if (parameter.websocketClients.containsKey(userid)) {
  350. JSONObject methodobject = new JSONObject();
  351. methodobject.put("type", "refreshimdialog");
  352. methodobject.put("timdialogid", timdialogid);
  353. for (WebClientSocket webClientSocket : parameter.websocketClients.get(userid).values()) {
  354. webClientSocket.sendSystemMessage(methodobject);
  355. }
  356. }
  357. }
  358. return getSucReturnObject().toString();
  359. } else {
  360. return getErrReturnObject().toString();
  361. }
  362. }
  363. /**
  364. * 话题内容查询
  365. *
  366. * @return
  367. */
  368. public String querySubject() {
  369. long timsubjectid = content.getLongValue("timsubjectid");
  370. SQLFactory timsubjectSQL = new SQLFactory(this, "话题查询");
  371. timsubjectSQL.addParameter("siteid", siteid);
  372. timsubjectSQL.addParameter("timsubjectid", timsubjectid);
  373. Rows imsubjectrows = dbConnect.runSqlQuery(timsubjectSQL.getSQL());
  374. for (Row imsubject : imsubjectrows) {
  375. SQLFactory timsubjectcontentSQL = new SQLFactory(this, "话题内容查询");
  376. timsubjectcontentSQL.addParameter("siteid", siteid);
  377. timsubjectcontentSQL.addParameter("timsubjectid", imsubject.getLong("timsubjectid"));
  378. Rows imsubjectcontentrows = dbConnect.runSqlQuery(timsubjectcontentSQL.getSQL());
  379. RowsMap map = getAttachmentUrl("timsubjectcontent", imsubjectcontentrows.toArrayList("timsubjectcontenid"));
  380. for (Row row : imsubjectcontentrows) {
  381. row.put("attinfos", map.get(row.getString("timsubjectcontenid")));
  382. }
  383. imsubject.put("imsubjectcontent", imsubjectcontentrows);
  384. if (!imsubject.getBoolean("fisclose")) {
  385. SQLFactory sqlFactory = new SQLFactory(this, "话题数据分析插入");
  386. sqlFactory.addParameter("siteid", siteid);
  387. sqlFactory.addParameter("timsubjectid", timsubjectid);
  388. sqlFactory.addParameter("tenterprise_userid", userid);
  389. sqlFactory.addParameter("tagentsid", tagentsid);
  390. dbConnect.runSqlUpdate(sqlFactory.getSQL());
  391. }
  392. }
  393. return getSucReturnObject().setData(imsubjectrows).toString();
  394. }
  395. /**
  396. * 根据对话框ID查询最新未关闭的话题内容
  397. *
  398. * @return
  399. */
  400. public String queryDialogUncloseSubject() {
  401. long timdialogid = content.getLongValue("timdialogid");
  402. Rows rows = dbConnect.runSqlQuery("select timsubjectid from timsubject where siteid='" + siteid + "' and timdialogid='" + timdialogid + "' and fisclose=0 order by timsubjectid desc");
  403. if (!rows.isEmpty()) {
  404. long timsubjectid = rows.get(0).getLong("timsubjectid");
  405. content.put("timsubjectid", timsubjectid);
  406. return querySubject();
  407. } else {
  408. return getSucReturnObject().toString();
  409. }
  410. }
  411. /**
  412. * 话题回复
  413. *
  414. * @return
  415. */
  416. public String subjectAnswer() {
  417. long timsubjectid = content.getLongValue("timsubjectid");
  418. Rows rows = dbConnect.runSqlQuery("select fisclose from timsubject where siteid='" + siteid + "' and timsubjectid=" + timsubjectid);
  419. if (!rows.isEmpty() && !rows.get(0).getBoolean("fisclose")) {
  420. dbConnect.runSqlUpdate("update timsubjectanalysis set fisanswer=1,fanswertime=getDate() where siteid='" + siteid + "' and timsubjectid='" + timsubjectid + "' and tenterprise_userid='" + userid + "' and fisanswer=0");
  421. }
  422. return getSucReturnObject().toString();
  423. }
  424. /**
  425. * 话题统计信息查询
  426. *
  427. * @return
  428. */
  429. public String querySubjectAnalysis() {
  430. long timsubjectid = content.getLongValue("timsubjectid");//话题ID
  431. long timdialogid = content.getLongValue("timdialogid");//对话框ID
  432. SQLFactory sqlFactory = new SQLFactory(this, "话题数据分析查询");
  433. sqlFactory.addParameter("siteid", siteid);
  434. sqlFactory.addParameter("timsubjectid", timsubjectid);
  435. sqlFactory.addParameter("timdialogid", timdialogid);
  436. Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
  437. for (Row row : rows) {
  438. row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
  439. }
  440. RowsMap fisreadmap = rows.toRowsMap("fisread");
  441. RowsMap fisanswermap = rows.toRowsMap("fisanswer");
  442. JSONObject object = new JSONObject();
  443. object.put("readlist", fisreadmap.get("1").toJsonArray());
  444. object.put("unreadlist", fisreadmap.get("0").toJsonArray());
  445. object.put("answerlist", fisanswermap.get("1").toJsonArray());
  446. object.put("unanswerlist", fisanswermap.get("0").toJsonArray());
  447. return getSucReturnObject().setData(object).toString();
  448. }
  449. }