formModeComOperation.jsp
4.37 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="weaver.general.Util" %>
<%@page import="com.weaver.formmodel.util.StringHelper"%>
<%@page import="weaver.conn.RecordSet"%>
<%@page import="java.text.SimpleDateFormat"%>
<jsp:useBean id="commentRecordSet" class="weaver.conn.RecordSet" scope="page" />
<%
String operation = Util.null2String(request.getParameter("method"));
String rqmodeid = Util.null2String(request.getParameter("rqmodeid"));
String rqid = Util.null2String(request.getParameter("rqid"));
String commentid = Util.null2String(request.getParameter("commentid"));
if(operation.equals("editComment")){
out.print(checkFormModeComment(rqmodeid,rqid,commentid));
}else if(operation.equals("deleteComment")){
String optSign = Util.null2String(request.getParameter("sign"));
if("comment".equals(optSign)){
out.print(checkFormModeComment(rqmodeid,rqid,commentid));
}else{
commentRecordSet.executeSql("select * from uf_Reply where rqmodeid="+StringHelper.empty2Null(rqmodeid)+" and rqid="+StringHelper.empty2Null(rqid)+" and commentid="+StringHelper.empty2Null(commentid));
if(commentRecordSet.getCounts()>0){
out.print("1");
}
}
}else if(operation.equals("delRealyComment")){
if(!StringHelper.isEmpty(commentid)){
commentRecordSet.executeSql("delete uf_Reply where rqmodeid="+StringHelper.empty2Null(rqmodeid)+" and rqid="+StringHelper.empty2Null(rqid)+" and id="+StringHelper.empty2Null(commentid));
}
}else if(operation.equals("getPagingInfo")){
int modeId = Util.getIntValue(request.getParameter("modeId"),0);
int billId = Util.getIntValue(request.getParameter("billId"),0);
int pageSize = Util.getIntValue(request.getParameter("pageSize"),10);
String sqlwhere = "";
String fmCommentContent = Util.null2String(request.getParameter("fmCommentContent"));
String fmCommentReplySdate = Util.null2String(request.getParameter("fmCommentReplySdate"));
String fmCommentReplyEdate = Util.null2String(request.getParameter("fmCommentReplyEdate"));
String fmCommentReplyor = Util.null2String(request.getParameter("fmCommentReplyor"));
String fmCommentFloorNum = Util.null2String(request.getParameter("fmCommentFloorNum"));
if(!StringHelper.isEmpty(fmCommentContent)){
sqlwhere+= " and replycontent like '%" + fmCommentContent + "%'";
}
if(!StringHelper.isEmpty(fmCommentReplySdate)){
sqlwhere+= " and replydate >= '" + fmCommentReplySdate + "'";
}
if(!StringHelper.isEmpty(fmCommentReplyEdate)){
sqlwhere+= " and replydate <= '" + fmCommentReplyEdate + "'";
}
if(!StringHelper.isEmpty(fmCommentReplyor)){
sqlwhere+= " and replyor = '"+fmCommentReplyor+"'";
}
if (!StringHelper.isEmpty(fmCommentFloorNum)) {
sqlwhere+= " and floorNum = " + fmCommentFloorNum + "";
}
int totalCount = 0; //评论的总信息条数
String selSql = "select count(1) from uf_Reply where rqmodeid="+modeId+" and rqid="+billId+" and commentid=0 "+sqlwhere+" ";
commentRecordSet.executeSql(selSql);
if(commentRecordSet.next()){
totalCount = commentRecordSet.getInt(1);
}
int totalPages = (totalCount + pageSize - 1)/pageSize;//总共页数
if (totalPages == 0) {
totalPages = 1;
}
out.print(totalCount+"_"+totalPages);
}
%>
<%!
private int checkFormModeComment(String rqmodeid,String rqid,String commentid){
Date nowdate=new Date();
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
RecordSet recordSet = new RecordSet();
recordSet.executeSql("select * from uf_Reply where rqmodeid="+StringHelper.empty2Null(rqmodeid)+" and rqid="+StringHelper.empty2Null(rqid)+" and commenttopid="+StringHelper.empty2Null(commentid));
if(recordSet.getCounts()>0){
return 1;
}
recordSet.executeSql("select * from uf_Reply where rqmodeid="+StringHelper.empty2Null(rqmodeid)+" and rqid="+StringHelper.empty2Null(rqid)+" and quotesid="+StringHelper.empty2Null(commentid));
if(recordSet.getCounts()>0){
return 2;
}
recordSet.executeSql("select * from uf_Reply where rqmodeid="+StringHelper.empty2Null(rqmodeid)+" and rqid="+StringHelper.empty2Null(rqid)+" and id="+StringHelper.empty2Null(commentid));
if(recordSet.next()){
String dateStr = recordSet.getString("replydate")+" "+recordSet.getString("replytime");
try{
Date discussDate=dateFormat.parse(dateStr);
long timePass=(nowdate.getTime()-discussDate.getTime())/(60*1000);
if(timePass>10){
return 3;
}
}catch(Exception e){
e.printStackTrace();
}
}
return 0;
}
%>