operDocReplyJSON.jsp
2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<%@ page language="java" contentType="application/json" pageEncoding="UTF-8"%>
<%@page import="net.sf.json.*"%>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.docs.docs.reply.BelongUtils" %>
<%@ page import="weaver.systeminfo.SystemEnv"%>
<jsp:useBean id="drm" class="weaver.docs.docs.reply.DocReplyManager" scope="page" />
<jsp:useBean id="docReplyServiceForMobile" class="weaver.docs.webservices.reply.DocReplyServiceForMobile" scope="page" />
<%
out.clearBuffer();
User user = HrmUserVarify.getUser (request , response) ;
if(user==null) {
Map result = new HashMap();
//未登录或登录超时
result.put("result", "200001");
result.put("error", SystemEnv.getHtmlLabelName(500584,user.getLanguage()));
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
return;
}
response.setContentType("application/json;charset=UTF-8");
//操作方式 saveReply:回复 delReply:删除回复 praise:点赞 unpraise:取消点赞
String operation = Util.null2String(request.getParameter("operation"));
if(!operation.equals("saveReply")
&&!operation.equals("delReply")
&&!operation.equals("praise")
&&!operation.equals("unpraise")
){
Map result = new HashMap();
//operation参数未设置正确
result.put("result", "200002");
result.put("error", SystemEnv.getHtmlLabelName(500674,user.getLanguage()));
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
return;
}
String docid = Util.null2String(request.getParameter("documentid"));
User userbelong = BelongUtils.getBelongUser(user,docid,request,response);
int replyid = Util.getIntValue(request.getParameter("replyid"));
int replytype = Util.getIntValue(request.getParameter("replytype"));
Map result =null;
if(operation.equals("saveReply")){
result = docReplyServiceForMobile.saveReply(request,userbelong);
if(result.get("replytype").equals("0"))
{
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
}
else
{
String lastReplyid = Util.null2String(request.getParameter("lastReplyid"));
String currdocid = Util.null2String(request.getParameter("docid"));
String jsonData = docReplyServiceForMobile.getResidueReplysForReply(lastReplyid,result.get("replymainid").toString(),currdocid,user,5);
out.println(jsonData);
}
}else if(operation.equals("delReply")){
result = docReplyServiceForMobile.delDocReply(replyid,user,docid);
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
}else if(operation.equals("praise")){
result = docReplyServiceForMobile.praise(replyid,replytype,user,docid);
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
}else if(operation.equals("unpraise")){
result = docReplyServiceForMobile.unPraise(replyid,replytype,user,docid);
JSONObject jo = JSONObject.fromObject(result);
out.println(jo);
}
%>